This works
<?php
$result = $conn->query('SELECT * FROM people
WHERE user="55"') or die(mysql_error());
$row = mysqli_fetch_array( $result );
echo $row['name'];
?>
But when I try to use a php variable, the following does not work:
<?php
$a = 55;
$result = $conn->query('SELECT * FROM people
WHERE user="$a"') or die(mysql_error());
$row = mysqli_fetch_array( $result );
echo $row['name'];
?>
Change This: $result = $conn->query('SELECT * FROM people WHERE user="$a"') or die(mysql_error());
To This: $result = $conn->query("SELECT * FROM people WHERE user='$a'") or die(mysql_error());
You must concat the values like below
Try this: