You are here: Re: Quick PHP and/or MySQL question « HTML « IT news, forums, messages
Re: Quick PHP and/or MySQL question

Posted by Hywel Jenkins on 06/06/05 22:20

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/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация