我用他的php mysql做错了什么

What my intention is to put a table on my website containg some fields from a datbase which contain an ID

$con = mysqli_connect('hostname','username','password','dbname');
if (!$con) {
    die('Could not connect: ' . mysqli_error($con));
}



$sql="SELECT * FROM Orders WHERE `Student UID` = '".$id."'";
$result = mysqli_query($con,$sql);
echo 
echo "<table><tr><th>Product</th><th>Cost</th></tr>";
while($row = mysqli_fetch_array($result)) {
    echo "<tr>";
    echo "<td>" . $row['MenuItemName'] . "</td>";
    echo "<td>" . $row['Price'] . "</td>";


    echo "</tr>";
}
echo "</table>";

At the moment when I am running this, I am jut getting a table like this

+---------+-------+
| Product | Price |
+---------+-------+

My database looks like this

+--------------+-------+-------------+
| MenuItemName | Price | Student UID |
+--------------+-------+-------------+
| Foo          |    99 |       12345 |
| Foo2         |    11 |       11111 |
| Foo2         |    11 |       12345 |
+--------------+-------+-------------+

What am I doing wrong with this?

Try changing this line:

$sql="SELECT * FROM Orders WHERE 'Student UID' = '".$id."'";

to:

$sql="SELECT * FROM Orders WHERE `Student UID` = '".$id."'";

Shout solve your issue.