Basically I would like to do the following in one single query. Is it possible?
$q = mysql_query('select * from table ORDER BY rand() LIMIT 5');
$s;
while($r = mysq_fetch_array($q)){
$s[i] = $r['id'];
// Do stuff
}
$u = mysql_query("update table SET lastUpdated = NOW() where id in (".implode(',',$s).")");
You can’t use select/update statements for the same table in the same query.