I was getting not a valid mysql function on mysql_fetch_array. Maybe, I am too tired and just can't see it.
<?php
echo "<table width=\"100%\" border=\"1\">
<tr>
<td align=\"center\">Highest rated</td>
<td align=\"center\">Number of votes</td>
</tr>";
include 'db2.php';
$con;
$db;
$mydb;
$sql = mysql_query("SELECT * FROM results") or die(mysql_error());
$result=mysql_query($sql, $con) or die(mysql_error());
$i=0;
while($row= mysql_fetch_array($result, MYSQL_BOTH)){
if ($i < mysql_num_fields($result)) {
echo"<tr>";
echo "<td align=\"left\">'. $row($i).'</td>";
echo "<td align=\"left\">'. $row($i).'</td>";
$i++;
echo "</tr>";
}
}
echo "</table>";
?>
I can echo $db;, but I can not echo mysql_num_fields($result). So the issue has to be:
$sql = mysql_query("SELECT * FROM results") or die(mysql_error());
$result=mysql_query($sql, $con) or die(mysql_error());