You're putting RAW data into MySQL, and not escaping it. That's a really Bad Idea. You should probably be using http://php.net/mysql_real_escape_string on the JPEG before you try to cram it into MySQL. If that still fails, you could http://php.net/base64 encode it or something similar to get it into 'safe' characters that MySQL won't choke on. That said... You really should consider using a highly-optimized large-sized-data custom piece of wonderful software that's really MUCH better for storing, managing, and retrieving JPEGs than MySQL... It's called: "the file system" You're almost for sure NOT using any real MySQL features on your JPEG data. It's not indexed for speed of retrieval based on raw bytes. It's not something you're going to search through the raw bytes for eye color. MySQL will RARELY (and only for tiny files) be any faster than the file system for retrieval. So you're just clogging up your database with this massive chunk of data for no real reason. On Thu, March 23, 2006 11:47 am, tedd wrote: > Hi gang: > > I posted this question to a MySQL list, but > apparently it stumped them. So, I'll ask here: > > On one server, the following code works without any problems > whatsoever: > > --- quote --- > > $sqlString = "INSERT INTO $dbtable (id, > image_type, image_large, image_small, > image_width, image_height, image_name, > image_size, date_time, date_created ) > VALUES ('', '{$type}', '{$image_large}', > '{$image_small}', '{$width}', > '{$height}','{$name}', '{$size}', '{$date_time}', > '{$date_created}')"; > $result = mysql_query($sqlString) or die("2. > Error in query $sqlString " . mysql_error()); > > --- un-quote --- > > However, on another server, it doesn't (remember > the code is identical for both). > > I have looked at the PHP Info on both servers, > the php versions are different (4.3.10 v 4.4.2) > but the mysql specifics are identical except the > version differs slightly (v 4.1.15 v 4.1.14). > > A clue, on the server it chokes on, if I reduce > the image size to 100 x 67 pixels, it will work. > However, if the image is 150 x 100 pixels, or > greater, it will crater. > > The error message is: > > 2. Error in query INSERT INTO as_table2 (id, > image_type, image_large, image_small, > image_width, image_height, image_name, > image_size, date_time, date_created ) VALUES ('', > 'image/jpeg', 'ÿØÿà\0JFIF\ > -snip- (the entire text file for the image) > 'v_small.jpg', '320000', '2006-03-22 14:10:55', > '2006-03-22 14:10:55') You have an error in your > SQL syntax; check the manual that corresponds to > your MySQL server version for the right syntax to > use near > 'ö~?L-?æÏôÏjâ?(xÏJ?÷Ý>Ô?s?íHñåE(?êÏØÊ?Ü"ÁíÎk????iË3¬4A''ÿ\0?Mm¿ä÷´?ÿ\0mÿ\0&¿' > at line 2 > > Any ideas? > > Many thanks in advance. > > tedd > -- > -------------------------------------------------------------------------------- > http://sperling.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php