I am having some trouble with my first PHP project, I am trying to get the data from MySQL database (Has 3 records) and display it in tables. Problem is it only seem to display
you are using two while loop which is unnecessary use following code
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
echo "";
echo "
ID
Name
";
$result = mysqli_query($con,"SELECT * FROM unitstats");
while($row = mysqli_fetch_array($result))
{
echo "";
echo "" . $row['id'] . " ";
echo "" . $row['name'] . " ";
echo " ";
}
echo "
";