Re: Apostrophe's

From: Date: Thu, 10 Aug 2000 06:11:48 +0000
Subject: Re: Apostrophe's
Groups: php.general 
Request: Send a blank email to php-general+get-11067@lists.php.net to get a copy of this message
I've looked at every document I can find in books and on the web, and still can't seem to solve this problem. Here is what I have. $Learned3 = mysql_query ("SELECT count(*) from cs_studentsurvey where LearnedSchoolProgram='I didn't learn very much'"); $Learned3results = mysql_fetch_row( $Learned3 ); print( $Learned3results[0] ); and I am getting this error. Warning: 0 is not a MySQL result index in ../count.php3 on line 134 The problem seems to be with the apostrophe. I've looked up stripslashes(), but can't find any documentation that will actually tell me how to use it. ---------- >From: R a n d y S e s s e r <rsesser@troikawebdesign.com> >To: Mike Tuller <mitull01@willy.wsc.edu> >Subject: Re: [PHP] Apostrophe's >Date: Wed, Aug 9, 2000, 2:06 PM > > stripslashes($NAME); that will take out the slashes and print everything > correctly > > Randy Sesser || Design Team > rsesser@troikawebdesign.com > ICQ: 36895710 > > ________________________________ > Troika Web Design > 841 S. Esmeralda Drive > Mesa, AZ 85208 > http://www.troikawebdesign.com > > > >> From: "Mike Tuller" <mitull01@willy.wsc.edu> >> Date: Wed, 09 Aug 2000 13:52:42 -0500 >> To: R a n d y S e s s e r <rsesser@troikawebdesign.com>, >> php-general@lists.php.net >> Subject: Re: [PHP] Apostrophe's >> >> I have the same problem, but it has shown up early, and I would like to >> change the value in the HTML. What do I need to change the value to? "'"? >> Will it then display in the database as an apostrophe? >> >> ---------- >>> From: R a n d y S e s s e r <rsesser@troikawebdesign.com> >>> To: php-general@lists.php.net >>> Subject: Re: [PHP] Apostrophe's >>> Date: Wed, Aug 9, 2000, 12:04 PM >>> >> >>> if it's adding "\" before the ' then you need stripslashes() >>> >>> at least that's my experience >>> _________________________________________ >>> r a n d y || s e s s e r >>> http://www.troikawebdesign.com >>> >>>> From: dustinl.rm@yahoo.com ("Dustin Leggans") >>>> Newsgroups: php.general >>>> Date: 9 Aug 2000 07:51:25 -0700 >>>> Subject: [PHP] Apostrophe's >>>> >>>> Hello... >>>> >>>> Using PHP and MYSQL in various database projects, I have run into the >>>> problem of having an apostrophe -- ' -- in a value.. For example, if >>>> someone submits "Bob's Wharehouse" as a value for the column >>>> SUPPLIER, I >>>> have to go in and either remove the apostrophe or "double" it >>>> ('') so it is >>>> interpreted appropriately. >>>> I have been doing this with the following code: >>>> $NAME = strtr($NAME, "'", "''"); >>>> >>>> I am wondering if there is an easier way to take care of this problem. As I >>>> am working with bigger database projects, it's becoming a real hassle to >>>> have to do this for every variable. Maybe there is something different I can >>>> do in my query string writing? Any suggestions will be much appreciated. >>>> >>>> Thanks, >>>> Dustin Leggans >>>> dustinl@rocketmail.com >>>> >>>> >>>> >>>> >>>> __________________________________________________ >>>> >>>> Do You Yahoo!? >>>> >>>> Talk to your friends online with Yahoo! Messenger. >>>> >>>> http://im.yahoo.com >>>> >>>> >>>> -- >>>> 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 >>>> >>> >>> >>> -- >>> 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 (#11067) next »