Re: [PHP] Entering data into MySQL

2002-02-25 Thread Jason Wong

On Monday 25 February 2002 15:39, Tim Thorburn wrote:
> Hi,
>
> I'm having troubles entering information from a form into a MySQL
> database.  Specifically if the user enters an apostrophe anywhere in the
> form, all the information is rejected and nothing is entered into the
> database.
>
> After researching a little on php.net I found the addslashes() command -
> this did help briefly and I was able to use apostrophe's in the form ...
> but it seems as the problem has resurfaced.
>
> To make matters more frustrating, the addslashes() command works perfectly
> well on my local test machine (Win2k Pro, PHP 4.1.1, MySQL 3.23.44, Apache
> 1.3.23) but not at all on the server which is hosted by another company
> (Sun Solaris, PHP 3.0.16, MySQL 3.22.32, Apache 1.3.12).
>
> Does anyone have any suggestions as to why the addslashes() command worked
> for a short time on the webserver and why it stopped?  Or better yet, is
> there a variation of addslashes() that will work on an older version of PHP
> such as 3.0.16?

It could be that the configuration of your local and remote servers are 
different. Specifically check out the setting magic_quotes_gpc. Run phpinfo() 
on both to find out their settings.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
grep me no patterns and I'll tell you no lines.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Entering data into MySQL

2002-02-24 Thread Andrey Hristov

Try doing it by yourself.
$the_str = str_replace('"','\"',$the_str);
$the_str = str_replace("'","\\'",$the_str);

This is a little hack until you find what is the problem with addslashes();

Best regards,
Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS

- Original Message - 
From: "Tim Thorburn" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, February 25, 2002 9:39 AM
Subject: [PHP] Entering data into MySQL


> Hi,
> 
> I'm having troubles entering information from a form into a MySQL 
> database.  Specifically if the user enters an apostrophe anywhere in the 
> form, all the information is rejected and nothing is entered into the database.
> 
> After researching a little on php.net I found the addslashes() command - 
> this did help briefly and I was able to use apostrophe's in the form ... 
> but it seems as the problem has resurfaced.
> 
> To make matters more frustrating, the addslashes() command works perfectly 
> well on my local test machine (Win2k Pro, PHP 4.1.1, MySQL 3.23.44, Apache 
> 1.3.23) but not at all on the server which is hosted by another company 
> (Sun Solaris, PHP 3.0.16, MySQL 3.22.32, Apache 1.3.12).
> 
> Does anyone have any suggestions as to why the addslashes() command worked 
> for a short time on the webserver and why it stopped?  Or better yet, is 
> there a variation of addslashes() that will work on an older version of PHP 
> such as 3.0.16?
> 
> I'd be eternally grateful for any prompt replies as its already 2.38am and 
> my deadline is 9am :P
> 
> Thank you
> -Tim Thorburn
> 
> 
> 
> -- 
> 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