UPDATE vs INSERT binary data

From: Date: Mon, 30 Oct 2000 09:23:40 +0000
Subject: UPDATE vs INSERT binary data
Groups: php.general 
Request: Send a blank email to php-general+get-22801@lists.php.net to get a copy of this message
<? // This works. $data = addslashes( fread(fopen($fname, 'r'), filesize($fname)) ); $query = "DELETE FROM product_image WHERE stockno = '123456' "; $result = mysql_db_query("store_db", $query); $query = "INSERT INTO product_image VALUES ( '123456', '$data', '', '' )"; $result = mysql_db_query("store_db", $query); ?> <? // This Doesnt $data = addslashes( fread(fopen($fname, 'r'), filesize($fname)) ); $query = "UPDATE product_image SET image_data = '$data' "; $query .= "WHERE stockno = '123456' "; $result = mysql_db_query("store_db", $query); ?> Am I doing something wrong here? I dont wan ttodo two SQL commands, im sure its slower, but also for fact that I loose the data in the other two fields. error msg: Error: 1064:You have an error in your SQL syntax near '123456' ' at line 1 image_data is of type longblob. Chris Lee Mediawaveonline.com

« previous php.general (#22801) next »