dimanche 12 février 2017

While looping sql query

I am trying to update all of the rows in a table in my database with a different value. I am trying to while loop the query to do this. Here's what I have...

<?php
$rand = rand(100,150000);
$start = 1;
$start += $start;
$start2 = $start +1;
echo $start;
while($start =< 686) {
echo "UPDATE table_video SET total_view = $rand WHERE id BETWEEN $start AND $start2;";
};
?>

I am sure most of you should be able to look at my code and understand what I am trying to accomplish. I would like the assistance. Thank You very much!




Aucun commentaire:

Enregistrer un commentaire