I keep getting this error on my page:
CODE
Unknown column 'ID' in 'order clause'
UserName ID
UserName ID
I have no idea what is wrong. I am good at fixing most errors in my script after they are pointed out, but this one just baffles me.
Here is the full code:
CODE
<?php
$con = mysql_connect("localhost","hidden","hidden");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("altapets_zxq_dbtables", $con);
$result = mysql_query("SELECT * FROM members ORDER BY ID");
echo "<table border='0'>
<tr>
<th>UserName</th>
<th>ID</th>
</tr>";
$sql = "SELECT * FROM users ORDER BY ID";
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "<tr>";
echo "<td>" . $row['UserName'] . "</td>";
echo "<td>" . $row['ID'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
$con = mysql_connect("localhost","hidden","hidden");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("altapets_zxq_dbtables", $con);
$result = mysql_query("SELECT * FROM members ORDER BY ID");
echo "<table border='0'>
<tr>
<th>UserName</th>
<th>ID</th>
</tr>";
$sql = "SELECT * FROM users ORDER BY ID";
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "<tr>";
echo "<td>" . $row['UserName'] . "</td>";
echo "<td>" . $row['ID'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
It is a script that will show a list of all registered members. Please note that the "hidden" is just so I don't give away my database username and password, as I use them for almost all things.
