I am trying to update my table column but I keep getting one value for all the rows, what am I doing wrong?
<?php
$count = 1;
while ( $count <= 30) {
$fmle_img = "_src/img/profile/female/u$count.png";
$db->query("UPDATE users SET image=:image WHERE (id > 31 AND id < 62)", array(':image'=>$fmle_img));
$count ++;
}
// this keeps giving me _src/img/profile/female/30.png for all the rows between id 32 and id 61
?>
2
Answers
You need to specify a single id in the WHERE clause of your sql statement.
Try
WHERE id = :id
and pass as:id
$count+30
.You must vary the where condition for each image: