Zymic Forums

Webmaster resources

Zymic IRC Server

Chat in real time at irc.zymic.com - Learn More

Welcome

Welcome to the Zymic webmaster forums. Our forums are here to provide people the free ability to discuss a range of websites related topics such as design, development coding and marketing.

In order to post you will need to register for a zymic account or if you already have one simply login by using the form on the left.

left Zymic Webmaster ForumsZymic Free Web HostingZymic Free Web Hosting - General Discussion & Help right
left right
PHP_student
post Sep 29 2009, 11:53 PM
Post #1


Member
**

Group: Members
Posts: 69
Joined: 29-September 09
Member No.: 111,978



Ok, I hope I am posting in the right section unsure.gif

I keep getting this error on my page:

CODE
Unknown column 'ID' in 'order clause'
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);
?>


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.
Go to the top of the page 
 
  + Quote Post
 
Start new topic
Replies
Ed
post Oct 2 2009, 11:08 AM
Post #2


Outrageously Uber Ninja
*******

Group: Administrators
Posts: 2,831
Joined: 11-March 07
From: UK
Member No.: 9



What's the table schema?

Go to the top of the page 
 
  + Quote Post

Posts in this topic

 Closed Topic Start new topic
left right
0 Members:
left right
 


Lo-Fi Version Time is now: 26th May 2013 - 05:17 AM