I am currently working a tutorial on php and mysql.I am currently working on a script which should read data from sql database and show that data in html table.I have a problem where the table is generated with empty fields. It has correct number of fields but those fields are empty.
Here is my php script:
<?php
require "init.php";
$select = "select * from ScoresTest";
$sqlSel = mysqli_query($con,$select);
if(mysqli_num_rows($sqlSel)>0)
{
echo("Works");
}
echo"<table border = '1'>
<tr>
<th>Username</th>
<th>Score</th>
</tr>";
while($row = mysqli_fetch_row($sqlSel))
{
echo "<tr>";
echo "<td>" . $row['USERNAME'] . "</td>";
echo "<td>" . $row['SCORES'] . "</td>";
echo "</tr>";
}
echo"</table>";
?>
Here is how the result looks like: Html table
Number of rows in my table is ok but the fields are empty.Why?
mysqli_error($con)shows you what? undefined indexes maybe?