Are you escaping the image string before you insert it?
berber
berber:
Aaahh, no ?? Why is it going to attack me?
But seriously, it works on one server, why not the other?
On the other hand, it appears to object to
something within the string -- so that might be
the problem. Please forgive my ignorance, but how
would I escape the image string -- do I use
dbx_escape_string() or would something else be
better?
tedd
-----Original Message-----
From: tedd [mailto:tedd@xxxxxxxxxxxx]
Sent: Thursday, March 23, 2006 7:48 PM
To: php-general@xxxxxxxxxxxxx
Subject: 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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
--------------------------------------------------------------------------------
http://sperling.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php