Quick PHP and/or MySQL question

  • Thread starter Paul F. Johnson
  • Start date
P

Paul F. Johnson

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
 
A

Adrienne

Gazing into my crystal ball I observed "Paul F. Johnson" <paul@all-the-
johnsons.co.uk> writing in
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.
 
H

Hywel Jenkins

arbpen2003 said:
Gazing into my crystal ball I observed "Paul F. Johnson" <paul@all-the-
johnsons.co.uk> writing in

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top