0

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>
2
Contributors
2
Replies
17
Views
3 Years
Discussion Span
Last Post by haze man
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.