Re: To slash or not to slash....

From: Date: Wed, 03 Sep 2003 12:18:01 +0000
Subject: Re: To slash or not to slash....
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-30298@lists.php.net to get a copy of this message
On Tue, 2 Sep 2003 16:45:28 +0100, Craig Cameron wrote: > >Ok simple problem I hope. > > >Have the following code, used to store the location and a few details about meeting minutes. > ><snip> > $connection = mssql_connect("server","user","password"); > mssql_select_db("DocumentManager",$connection); > > $AlteredMinutesLocation = str_replace("\\","\",$MinutesLocation); > > $SQL_STRING = "INSERT INTO tblMeetingMinutes >VALUES('$Date','$Type','$AlteredMinutesLocation','$Centre')"; > > > $Result = mssql_query($SQL_STRING,$connection); > mssql_close($connection); > ></snip> > >Problem is the backslashes. When I collect the filepath ($Location) it puts \\ into the db. >However, when I change this it stops dead. Basically due to the escape charateristics of the >backslash. I can get around this with single quotes of course but can't put these in the >SQL_STRING as it falls down there then! > >Somebody must have come across this before, any help much appreciated. > >Cheers > >Craig > Try using the built-in functions addslashes() and stripslashes(). Doug

« previous php.db (#30298) next »