im having a problem regrading a query which will update earning table with another random value from users table.
when executing the query it do nothing
$update = mysql_query("UPDATE earnings SET userid = (SELECT ID FROM users WHERE installid is NULL ORDER BY rand()) WHERE userid='0'");
in the second query
SELECT ID FROM users WHERE installid is NULL ORDER BY rand()
it will get me a random userid where installid null
Have you tried that query in phpMyAdmin etc? Are you getting an error?
Have you tried:
So that the full query becomes:
However keep in mind that you may end up having duplicate userid values in the earnings table.