php - How to update random row in database? -
how update random row in database using rand() clause
here trying right now, not working not sure whats wrong
mysql_query("update `user` set `token` = '$session' not toke = '1' limit 1 rand()");
your query not valid. first of there typo in it, toke
should token
. where not
should where token <> '1'
. can indeed use rand()
, on order by
clause. query should this:
mysql_query("update `user` set `token` = '$session' `token` <> '1' order rand() limit 1");
Comments
Post a Comment