RE: [PHP-DB] SQL newbie

From: Date: Sun, 08 Sep 2002 11:12:28 +0000
Subject: RE: [PHP-DB] SQL newbie
Groups: php.db 
Request: Send a blank email to php-db+get-21636@lists.php.net to get a copy of this message
You can always do something like : $MyPossiblyProblematicString = addslashes($MyPossiblyProblematicString); Before you put it in the query or use magic_quotes_gpc : Sets the magic_quotes state for GPC (Get/Post/Cookie) operations. When magic_quotes are on, all ' (single-quote), " (double quote), \ (backslash) and NUL's are escaped with a backslash automatically. If magic_quotes_sybase is also on, a single-quote is escaped with a single-quote instead of a backslash Sincerely berber Visit http://www.weberdev.com/ Today!!! To see where PHP might take you tomorrow. -----Original Message----- From: John W. Long [mailto:johnwlong@characterlink.net] Sent: Friday, September 06, 2002 5:00 AM To: php-db@lists.php.net Subject: [PHP-DB] SQL newbie Hi, I'm using the following statements to insert a record into a table: $SQL_Exec_String = "Insert Into Messages (ReplyID,Subject,Sender,Email,Message,Reviewed) Values ($ReplyID,'$Subject','$Sender','$Email','$Message',$Reviewed)"; $cur = odbc_exec( $cnx, $SQL_Exec_String ); This works great except when I have a string like "don\'t get in my way" which has an apostrophe in it and causes the statement to get confused. It seems to me that SQL should have an escape sequence of some kind. Can someone get me pointed in the right direction? Thanks! ___________________ John Long www.wiseheart.20m.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.db (#21636) next »