Fwd: Re: [PHP] Separators in variable values causing MySQL commands to fail

2003-03-22 Thread L0vCh1Y
-> rentAweek, rL> In my PHP script I have coded e.g.: rL> $sql = "INSERT INTO `$owners` ( `FirstName`, `LastName`) VALUES ( rL> '$firstname' , '$lastname' )"; rL> $result = mysql_query($sql); rL> So along comes e.g. John O'Groats and nothing gets inserted into the rL> database. rL> OK, I can

Re: [PHP] Separators in variable values causing MySQL commands to fail

2003-03-22 Thread Larry E. Ullman
OK, I can bypass my oversight by stripping out apostophes from the variable values. There has to be a better way please. Turn on Magic Quotes GPC or use the addslashes() function. Or, if you want to be more precise and MySQL-specific, use the mysql_escape_string() or mysql_real_escape_string() f

Re: [PHP] Separators in variable values causing MySQL commands to fail

2003-03-22 Thread Jim Lucas
and , you need to escape the values that you are inputing ie. htmlspecialchars() or htmlentities() those values Jim - Original Message - From: "rentAweek Ltd" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, March 22, 2003 9:50 AM Subject: [PHP] Separat

Re: [PHP] Separators in variable values causing MySQL commands to fail

2003-03-22 Thread David Otton
On Sat, 22 Mar 2003 17:50:30 +, you wrote: >OK, I can bypass my oversight by stripping out apostophes from the >variable values. There has to be a better way please. http://www.php.net/manual/en/function.mysql-escape-string.php -- PHP General Mailing List (http://www.php.net/) To unsubscr

Re: [PHP] Separators in variable values causing MySQL commands to fail

2003-03-22 Thread Jim Lucas
you must remove the backticks. Jim - Original Message - From: "rentAweek Ltd" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, March 22, 2003 9:50 AM Subject: [PHP] Separators in variable values causing MySQL commands to fail > In my PHP script I h

[PHP] Separators in variable values causing MySQL commands to fail

2003-03-22 Thread rentAweek Ltd
In my PHP script I have coded e.g.: $sql = "INSERT INTO `$owners` ( `FirstName`, `LastName`) VALUES ( '$firstname' , '$lastname' )"; $result = mysql_query($sql); So along comes e.g. John O'Groats and nothing gets inserted into the database. OK, I can bypass my oversight by stripping out apost