...

View Full Version : php commas in queries



nickyfraggle
01-29-2007, 11:49 PM
I'm outputting data from my database. I'm using $_REQUEST to get a value to query my database e.g news.php?headline=new headline.

I'm then searching for 'new headline' in my database and outputting the related information.

My problem is that it isn't working for any headlines with commas in them eg.
'News Headline' todays news. It can't seem to find anything in the database if it has a comma in it.

When I add to the database, I used addslashes(). I'm not striping the slashes...could this be why? But when I look in the database, there doesn't seem to be any slashes in there?

Any help is appreciated,

Thanks,

Nicola

martialtiger
01-30-2007, 12:11 AM
Try using mysql_real_escape_string in your query statement.

Good luck!

nickyfraggle
01-30-2007, 09:13 PM
Thanks for your help. Often I find half the problem is not actually knowing what you're looking for. I did a Google search, but nothing like this came up.

Having a go now.

Thanks again,

Nicky



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum