I am trying to copy image blobs from one table to another, and it is not working, since the mysql_real_escape_string () is no longer available. The special characters in the blob are blocking the insert and I can't figure out how to correct this. Your help would be appreciated. Thank you.
foreach ($dbh->query($query_images) as $images-1) {
$ins = "INSERT INTO images-2 SET image_blob='".images-1['image_blob']."'";
$dbh->exec($ins);
}
First you have:
when you likely want:
but that could just be a typo in your post.
You can do this in pure MySQL and not have to iterate through each row in the images-1 table:
If it is some kinda of escaping problem I would suggest going with the PDO stuff in PHP:
I did not test any of this code but just put it together based on documentation and experience.