Re: Problems with SQL queries in PHP script

From: Date: Sat, 08 Feb 2003 17:25:52 +0000
Subject: Re: Problems with SQL queries in PHP script
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-134881@lists.php.net to get a copy of this message
http://www.php.net/manual/en/function.addslashes.php Justin Garrett "Mike Hilty" <mikeh_22@hotmail.com> wrote in message news:20030208171819.18073.qmail@pb1.pair.com... > Hello, > I am running into an issue where when a user inputs an apostrophie ' > into the textarea section of my form, it will generate an error in the SQL > statement. > I have narrowed down the issue to this snippet of code: > > $insertQuery = "INSERT INTO changeLog(vendorNumber, newVendorNumber, > oldName, newName, changedBy, dateChanged, comments) > VALUES('$vendorNumber','$newVendorNumber','$oldName','$newName','$changedBy' > ,'$dateChanged','$comments')"; > > The thing that is causing this issue is the use of apostrophies to > designate my variables in the SQL query. How do I rewrite this to avoid > this issue? > > > > Thanks, > > Mike Hilty > > >

« previous php.general (#134881) next »