hi there,
I am currently doing data migration from old database to new database(with different database structure) , since i don't want to copy the files from one table to another table manual, i wrote a script. For information, i am currently using MySQL as my database.
I am having problem in transfering image data field itself (BLOB format) from one old table (exiting database) to new table (in new database), but, other fields like img_filename, img_type is no problem. Below is the code :
......
$result = mysql_db_query($source_database, "SELECT * FROM image LIMIT 0,1;", $link);
while ($object = mysql_fetch_array($result)){
$query = "INSERT INTO image_library VALUES ('', '".$object['img_type']."', '', '".$object['img_data']."', '".$object['img_size']."', '".$object['img_filename']."', '".$object['img_title']."','', '1', '34');";
$result2 = mysql_db_query($des_database, $query, $link2)
}
.....
after i run this piece of code, i check on my database, the data is there for img_type, img_title, img_filename and etc. But, i just wonder why img_data (which is the actual data) is not there.
My question is : Is this the right way to transfer image file from one table to another table? If not, how?
Regards,
Fresh Guys
I am currently doing data migration from old database to new database(with different database structure) , since i don't want to copy the files from one table to another table manual, i wrote a script. For information, i am currently using MySQL as my database.
I am having problem in transfering image data field itself (BLOB format) from one old table (exiting database) to new table (in new database), but, other fields like img_filename, img_type is no problem. Below is the code :
......
$result = mysql_db_query($source_database, "SELECT * FROM image LIMIT 0,1;", $link);
while ($object = mysql_fetch_array($result)){
$query = "INSERT INTO image_library VALUES ('', '".$object['img_type']."', '', '".$object['img_data']."', '".$object['img_size']."', '".$object['img_filename']."', '".$object['img_title']."','', '1', '34');";
$result2 = mysql_db_query($des_database, $query, $link2)
}
.....
after i run this piece of code, i check on my database, the data is there for img_type, img_title, img_filename and etc. But, i just wonder why img_data (which is the actual data) is not there.
My question is : Is this the right way to transfer image file from one table to another table? If not, how?
Regards,
Fresh Guys