RE: [PHP] Why does this work on one server, but not another?
| From: | Weber Sites LTD | Date: | Thu, 23 Mar 2006 17:52:53 +0000 |
| Subject: | RE: [PHP] Why does this work on one server, but not another? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-232462@lists.php.net to get a copy of this message | ||
Are you escaping the image string before you insert it?
berber
-----Original Message-----
From: tedd [mailto:tedd@sperling.com]
Sent: Thursday, March 23, 2006 7:48 PM
To: php-general@lists.php.net
Subject: [PHP] Why does this work on one server, but not another?
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