![]() |
Quick PHP and/or MySQL question
Hi,
I'm developing something for a friend and for some reason, my mind has gone wibble and I've forgotten something. Point your browsers at http://82.42.51.231/cta/pchardware/video.php and you'll see it virtually instantly. Around the text in the first two columns are quote marks. I'm using PHP to access a MySQL database and I have a feeling the quotes are part of the dataset imported. I either need to strip the quotes from the SQL database *or* in the PHP. Question is, how do I do either of them? All my books on this are at work. It's been a hectic weekend and my mind is giving up. Help would be appreciated :-) TTFN Paul -- "Space", it says, "is big. Really big. You just won't believe how vastly, hugely, mind-bogglingly big space really is. I mean, you may think it's a long way down the road to the chemists, but that's just *peanuts* compared to space, listen" - Hitch Hikers Guide to the Galaxy |
Re: Quick PHP and/or MySQL question
Gazing into my crystal ball I observed "Paul F. Johnson" <paul@all-the-
johnsons.co.uk> writing in news:1118010854.3910.13.camel@localhost: > Hi, > > I'm developing something for a friend and for some reason, my mind has > gone wibble and I've forgotten something. > > Point your browsers at http://82.42.51.231/cta/pchardware/video.php and > you'll see it virtually instantly. Around the text in the first two > columns are quote marks. > > I'm using PHP to access a MySQL database and I have a feeling the quotes > are part of the dataset imported. I either need to strip the quotes from > the SQL database *or* in the PHP. Question is, how do I do either of > them? > > All my books on this are at work. It's been a hectic weekend and my mind > is giving up. Help would be appreciated :-) > > TTFN > > Paul Single quotes are used in SQL statements as delimiters and must be escaped. I use a tilde mark, and have created functions to replace ' with ~ for inserts/updates and replace ~ with ' when printing out the recordset. -- Adrienne Boswell http://www.cavalcade-of-coding.info Please respond to the group so others can share |
Re: Quick PHP and/or MySQL question
In article <Xns966D6FB019EBAarbpenyahoocom@207.115.63.158>, arbpen2003
@sbcglobal.net says... > Gazing into my crystal ball I observed "Paul F. Johnson" <paul@all-the- > johnsons.co.uk> writing in news:1118010854.3910.13.camel@localhost: > > > Hi, > > > > I'm developing something for a friend and for some reason, my mind has > > gone wibble and I've forgotten something. > > > > Point your browsers at http://82.42.51.231/cta/pchardware/video.php and > > you'll see it virtually instantly. Around the text in the first two > > columns are quote marks. > > > > I'm using PHP to access a MySQL database and I have a feeling the quotes > > are part of the dataset imported. I either need to strip the quotes from > > the SQL database *or* in the PHP. Question is, how do I do either of > > them? > > > > All my books on this are at work. It's been a hectic weekend and my mind > > is giving up. Help would be appreciated :-) > > > > TTFN > > > > Paul > > Single quotes are used in SQL statements as delimiters and must be escaped. > I use a tilde mark, and have created functions to replace ' with ~ for > inserts/updates and replace ~ with ' when printing out the recordset. How about addslashes() and stripslashes() for PHP? With PHP, the server admin. can enable MAGIC_QUOTES which takes care of this for you. It's worth coding for the eventuality that the magic quotes setting will be reversed by checking whether they're on or not. The PHP docs has info. on this. -- Hywel Kill the Crazy Frog http://www.petitiononline.com/crzyfrg/ |
| All times are GMT. The time now is 07:52 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.