mysql_query("UPDATE users SET id =`id`+ 2 + ROUND(RAND() * 3) where username = '".$_SESSION['username']."'"); 

How to calculate which numbers to replace with id, please drop the calculation algorithm, thanks in advance.

    3 answers 3

     $id = $id + 2 + rand(0,3); 

      It looks like two queries:

       SELECT id FROM `users` WHERE username = '{$_SESSION["username"]}' FOR UPDATE // вытаскиваем $id // что-то делаем с id типа: // $id += 2 + rand(0,3); UPDATE `users` SET id = {$id} WHERE username = '{$_SESSION["username"]}' 

      Then, from the time select to update, the line is loaded

      • and thank you =) - oOKomarOo

      Can not calculate.