Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
thefreebielife
Forum Contributor
Posts: 126 Joined: Thu Apr 26, 2007 2:59 pm
Post
by thefreebielife » Thu Aug 23, 2007 1:33 pm
Code: Select all
else
$sql="select * from users where site=Cash order by uId";
}
$result = mysql_query($sql)
or die(mysql_error());
$i = 0;
//grab all the content
while($r=mysql_fetch_array($result))
{
That code displays nothing, I assume there is a problem with the "where" because i get this error
"Unknown column 'Cash' in 'where clause'"
Thanks,
Jared
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Thu Aug 23, 2007 1:55 pm
You have to mark string literals for mysql with single quotes.
site='Cash'
nickvd
DevNet Resident
Posts: 1027 Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:
Post
by nickvd » Thu Aug 23, 2007 3:02 pm
Maybe there IS no data to display...
Try your query in phpmyadmin...
thefreebielife
Forum Contributor
Posts: 126 Joined: Thu Apr 26, 2007 2:59 pm
Post
by thefreebielife » Thu Aug 23, 2007 3:07 pm
No, there is data... since the default for "site" IS "Cash".. but from now on it may vary. What "site" may be.
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Thu Aug 23, 2007 3:44 pm
There evidently is no rows with Site = 'Cash' if no rows were returned..
Can you provide a same export of your table with data?
Moved to Databases.