Page 1 of 1

Selection issue

Posted: Thu Aug 23, 2007 1:33 pm
by thefreebielife

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

Posted: Thu Aug 23, 2007 1:55 pm
by volka
You have to mark string literals for mysql with single quotes.
site='Cash'

Posted: Thu Aug 23, 2007 2:01 pm
by thefreebielife
I tried - but now theres no error, but no data.

Posted: Thu Aug 23, 2007 3:02 pm
by nickvd
Maybe there IS no data to display...

Try your query in phpmyadmin...

Posted: Thu Aug 23, 2007 3:07 pm
by thefreebielife
No, there is data... since the default for "site" IS "Cash".. but from now on it may vary. What "site" may be.

Posted: Thu Aug 23, 2007 3:44 pm
by John Cartwright
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.