RE: [PHP] ' database problem

From: Date: Sun, 02 Jul 2000 23:45:32 +0000
Subject: RE: [PHP] ' database problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-4412@lists.php.net to get a copy of this message
Simply, use the PHP function addslashes() on the string you are inserting into the database. It will 'escape' any of those pesky user entered problems. $string2 = addslashes($string1); $query = "insert into table (value) values ('$string2')"; Have Fun. > -----Original Message----- > From: Apathy [mailto:robert@crazymooseNOSPAM.co.uk] > Sent: Sunday, July 02, 2000 4:34 PM > To: php-general@lists.php.net > Subject: [PHP] ' database problem > > > Hi, > > I have a form for my clients to fill out on a website I'm developing. > Everything seemed to be going great until I inluded a ' in one of > the field > inputs. The entry just doesn't work when this is included. > > For the sake of making it simple for the clients, is there a way I can get > the entry to work with ' without saying "don't use ' ". i.e. a > script thing > that automatically removes ' from any database entries. > > Thanks, > > Robert Morrissey > > -- > Crazy Moose > http://www.crazymoose.co.uk > Providing Web Design, Hosting and IT Support > > > > -- > 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 (#4412) next »