View Full Version : php commas in queries

01-30-2007, 12:49 AM
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,



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

Good luck!

01-30-2007, 10: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,