Quick PHP and/or MySQL question

Discussion in 'HTML' started by Paul F. Johnson, Jun 5, 2005.

  1. 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
     
    Paul F. Johnson, Jun 5, 2005
    #1
    1. Advertising

  2. Paul F. Johnson

    Adrienne Guest

    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
     
    Adrienne, Jun 6, 2005
    #2
    1. Advertising

  3. 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/
     
    Hywel Jenkins, Jun 6, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JKop
    Replies:
    11
    Views:
    937
  2. Ted Zeng
    Replies:
    4
    Views:
    569
    Tim Arnold
    Oct 3, 2006
  3. Ted Zeng
    Replies:
    0
    Views:
    684
    Ted Zeng
    Oct 13, 2006
  4. Rajive Narain
    Replies:
    0
    Views:
    2,081
    Rajive Narain
    Sep 18, 2009
  5. neha shena
    Replies:
    1
    Views:
    281
    Dennis Lee Bieber
    Oct 29, 2010
Loading...

Share This Page