Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Mar 2006
    Posts
    200
    Thanks
    27
    Thanked 2 Times in 2 Posts

    php commas in queries

    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

  • #2
    New Coder
    Join Date
    Jul 2006
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try using mysql_real_escape_string in your query statement.

    Good luck!

  • #3
    Regular Coder
    Join Date
    Mar 2006
    Posts
    200
    Thanks
    27
    Thanked 2 Times in 2 Posts

    Thank you

    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •