Re: Special characters --> single quote

From: Date: Tue, 22 Aug 2000 13:43:02 +0000
Subject: Re: Special characters --> single quote
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-12937@lists.php.net to get a copy of this message
Hope you are well slept James ... :-))))) This function addslashes add a slash before special characters like " or '. So when I use your query, each double quote have a slash before ( like this... test zqkfzerz\"\" h\"h ) when recording --> not very interesting to record this in a database. and for the single quote, I have got always the same error = My database show me a message errors which indicates there is an incorrect syntax. :-( Regards, Ludovic James Moore a écrit : > TO early in morning, typo on my part. > > "UPDATE toto SET OBSERVATION = '".addslashes($OBSERVATION)."' WHERE > id=$number" > > > -----Original Message----- > > From: ludovic [mailto:ludovic@logosapience.com] > > Sent: 22 August 2000 13:58 > > To: James Moore > > Cc: php-general@lists.php.net > > Subject: Re: [PHP] Special characters --> single quote > > > > > > James, > > > > If I make > > "UPDATE toto SET OBSERVATION = '".addslashes."' WHERE > > id=$number"; > > I will see in the field OBSERVATION the string addslashes, isn't it ? > > > > I don't think that the uppercase or lowercase is important for > > the name of the > > table ... > > Anymore, I have tried in lower case but always the same problem... > > UPDATE toto SET observation = '$OBSERVATION' WHERE id=$number > > > > The only solution that I have found for the moment is to replace > > the single > > quote by the double quote > > but I am not very satisfied by this one. > > $OBSERVATION=ereg_replace("[']","\"",$OBSERVATION); > > > > I have got the same problem for MicrosoftSQLServer. > > > > James Moore a écrit : > > > > > > > > > > This is the query > > > > > > > > $query = > > > > "update toto set > > > > OBSERVATION='$OBSERVATION' where id =$number"; > > > > > > OK. > > > > > > "UPDATE toto SET OBSERVATION = '".addslashes."' WHERE > > > id=$number"; > > > ^^^^^^^^^^^- Personal opinion but tables should be in > > > lowercase when created, then they are easier to see in SQL > > statements, (Caps > > > all Keywords, lowercase all table/col names). > > > > >

« previous php.general (#12937) next »