dimanche 22 avril 2018

update sql with two values in several times

I want to update my table based on 2 values (a, b), .. a: is the number that needs to stored and b: is the repeated times.. as examples (1, 17); (4, 5); (8, 7) .. so here needs to be store “1” in 17 times or 17 records, then go next to store value “4” in next 5 records then go next store “8” in next 7 records.. and so on till finish all (a,b) values .. total table records are 500, so here I will use allot of (a,b)

for($i = 1; $i<=$b; $i++) {

$sql = "UPDATE tbl_ AAA SET goals = '$a' WHERE goal_id = '$i' ";

Is there any simple solution that I paste my all (a,b) around 240 (a, b)




Aucun commentaire:

Enregistrer un commentaire