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

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -