RE: [PHP] Code check please

From: Date: Thu, 21 Jun 2001 06:09:04 +0000
Subject: RE: [PHP] Code check please
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-54693@lists.php.net to get a copy of this message
It just occurred to me that one thing that will kill a query is special query characters imbedded in your strings, like quotes (single or double). This can be resolved by the $resultstring = addslashes($sourcestring); this should escape special characters normally used to signal key components to the mysql query processor. of course when you select the column you need to run it thru; $resultstring = stripslashes($dbcolumnvalue); to get back your original value. good luck, Warren Vail -----Original Message----- From: Andreas Skarin [mailto:sdts@sdts.nu] Sent: Wednesday, June 20, 2001 3:46 PM To: PHP General Subject: Re: [PHP] Code check please I'm sorry guys, neither of the snippets work. I must have screwed something else up too. Is there any way I can provoke an error message from your code examples below? If anyone manages to find out what's wrong, please tell me. I'm not giving up until I smash this bug :-) // Andreas > Rich Cavanaugh wrote: > > > try: > > > > $sql = "INSERT INTO tabell (fornamn, efternamn, email) values ('{$fornamn}', > > '{$efternamn}', '{$email}')"; > > Sebastian Wenleder wrote: > > > I'd use this SQL-query: > > > > $sql = "INSERT INTO tabell \ > > (fornamn,efternamn,email) \ > > VALUES(".$fornamn.", \ > > ".$efternamn.", ".$email.")"; -- Andreas Skarin Svenska Dream Theater-Sällskapet http://www.sdts.nu - mailto:sdts@sdts.nu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#54693) next »