[thelist] php escaped characters problem

Lez Lytollis Lez.Lytollis at ccr.ntu.ac.uk
Mon Jun 19 09:56:44 2000


Hi All,

I have a written a simple php/mysql news input interface for our admin staff
to add articles to our website. When they have an article name containing a
single quote, the string is cut off at that point on generation of the sql
string.

example
---------

original typed entry in description field: Lez's quote test
echoed $description value: Lez\'s quote test
$strsql = "INSERT INTO news (description) VALUES ( '$description' )";
echoed $strsql value: INSERT INTO news ( description )
    VALUES ( 'Lez\')

I have turned off magic quotes and now I get
echoed $description value: Lez's quote test
echoed $strsql value:
INSERT INTO news ( description )
    VALUES ( 'Lez')

Can anyone (Matt?) tell me what is going on and how I can fix it?

Thanks in advance

Lez