RE: Why does this work on one server, but not another?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Are you escaping the image string before you insert it?

berber 

-----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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux