I want to give a unique name to each image in a folder and move them into another folder, and then update table posts
according the new value.
$list = glob("../cardimg/*.jpg");
$x = 1;
foreach ($list as $item) {
$id = uniqid();
rename ($item, "../carda/" . $id . ".jpg");
$st = $db->query("update posts set img = " . $id . " where id = " . $x);
$x++;
}
Error:
Unknown column '5ac7d19eb11d8'...
But I know - there is no such a column in my table - I want to update img
column.
id
column is from 1
to 50
.
Why I'm getting this error?