mercredi 1 mars 2017

Populating all rows from a column in SQL from a random PHP integer

I have a SQL database with data however would like to populate a certain field in every row with a different random integer.

The code works to populate the field with one single random integer therefore my question is how do you loop for each row while assigning it a random integer.

PHP Code Snippet:

 $data = rand(intval(5000),intval(57000));
 echo $data;
 $sql = "UPDATE Test SET Projection = ".$data;
 mysqli_query($conn,$sql);
 echo "complete"




Aucun commentaire:

Enregistrer un commentaire