I have set up a data base called assignment with a table called 'Parts' in it. But when i run the follwoing code on my local host i get the following error "Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in /Applications/XAMPP/xamppfiles/htdocs/lab9.php on line 8". Can anyone help me fix this and help me print out the contents of the table.

<html>
<head>
<?php
$con = mysqli_connect("localhost", "root","","Assignment");
echo '<table border="1">'."\n";
$result = mysqli_query($con,"SELECT * FROM user");
while ( $row = mysqli_fetch_array($result))
    {
    echo("</tr><td>");
    echo(htmlentities($row[0]));
    echo("</td><td>");
    echo(htmlentities($row[1]));
    echo("</td><td>");
    echo(htmlentities($row[2]));
    echo("</td><td>");
    echo(htmlentities($row[3]));
    echo("</td><td>");
    echo(htmlentities($row[4]));
    echo("</td><td>\n");
    echo('<a href="edit.php?id=' .htmlentities($row[0]).' ">Edit</a> /');
    echo('<a href="delete.php?id=' .htmlentities($row[0]).' ">Delete</a> ');
    echo("</td></tr>\n");
    }
mysqli_close($con); 

?>
</table>
<a href="add.php">Add New</a>

Your looking for a table called parts, yet you are querying a table named users?

Sorry i uploaded the wrong code, I have chnaged it to 'parts' but am still getting the same error

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.