I need to update id column of several tables with php uniqid()
values
after running this code - all rows inside each table has the same value
how to set different value for each row ?
$arr = ['lorem', 'ipsum', 'dolor']; // table names
foreach($arr as $tb){
$st = $db-> prepare("select * from " . $tb);
$st -> execute();
$arrb = $st->fetchAll();
foreach($arrb as $elb){
$id = uniqid();
$sqb = "update " . $tb . " set id = :aid";
$stb = $db->prepare($sqb);
$stb->execute([":aid" => $id]);
}
}