Home > Net >  PHP SQL Unexpected identifier "mysqli_select_db"
PHP SQL Unexpected identifier "mysqli_select_db"

Time:03-17

I am receiving this error when trying to get my database to connect

'Parse error: syntax error, unexpected identifier "mysqli_select_db"'

Here is the code:

    <?php

$conn = mysqli_connect('localhost', 'root')
mysqli_select_db($conn, 'items');
$sql = "SELECT * FROM 'stock' WHERE stock=1";
$item = $conn->query($sql);
?>

CodePudding user response:

You forgot the semi-colon on the first line.

<?php
  $conn = mysqli_connect('localhost', 'root');
  mysqli_select_db($conn, 'items');
  $sql = "SELECT * FROM 'stock' WHERE stock=1";
  $item = $conn->query($sql);
?>
  • Related