mysql - Select random row in SQL where Status = 0 using php -


i wonder... possible select random row in db record contains field->status = 0 ? because need row contains 0 in field name=status. if status contains = 1 , row not belong in randomization.

my code in query is

$result = mysql_query( " select * `$haha` order rand() limit 1");<br> $result = mysql_query( " select * `$haha` order rand() limit 1 status=0"); 

but not work.. appreciate replies.. thank much!

try below code:

$result = mysql_query("select * `".$haha."` status=0 order rand() limit 0,1"); 

your clause should before order clause.

and want know value of $haha.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -