Copy binary data from onte table to another

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Astyanax
Forum Newbie
Posts: 1
Joined: Fri Oct 03, 2008 7:52 pm

Copy binary data from onte table to another

Post 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
madan koshti
Forum Commoner
Posts: 50
Joined: Fri Jun 06, 2008 4:25 am

Re: Copy binary data from onte table to another

Post 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\"");
Post Reply