Page 1 of 1

Copy binary data from onte table to another

Posted: Fri Oct 03, 2008 8:09 pm
by Astyanax
Hello

I want to take binary data from one table and insert it to another but I get sql error dooing this and I can't figure out why. I try to do like this:

$dbQuery = sprintf("SELECT fileContent, filType FROM myFiles WHERE id = $id");
$result = mysql_query($dbQuery) or die("Couldn't get file list");

while ($row = mysql_fetch_assoc($result)) {
$fileContent = $row['fileContent'];
$fileType = $row['fileType'];
}

mysql_query("INSERT INTO myNewFiles (fileData, fileType) VALUES('$fileContent', '$fileType') ")
or die(mysql_error());

Can anyone help me, please...

Regards

Re: Copy binary data from onte table to another

Posted: Sat Oct 04, 2008 7:21 am
by madan koshti
Hi,

Please mention problem/error in detail!

Any way,why u don't try following way ?

mysql_query("INSERT INTO myNewFiles (fileData, fileType) SELECT fileContent, filType from tab1 WHERE id =\"$id\"");