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 1 of 1
  1. #1
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts

    problem matching values with apostrophe

    Hello,
    Edit:
    stoopid. I forgot about placeholders. sorry

    I am querying a MySQL table to match a form/session value with a col value.

    The two values to be matched are "john's" (without the double quotes)

    when I run the query the apostrophe needs to be escaped?? but then there is no match

    what way should I change the query please?

    Code:
    SELECT bd.phone_number
             , bd.fax_number
             , bd.email_address
             , bd.web_url
             FROM business_details bd 
             WHERE bd.grp_name = '$selected_group_name'
             and bd.premises = '$selected_premises_name'
    If I surround the $selected_premises_name with backticks, it tells me there is no column of that name which suggests the backticks tell it to match col names rather than column values.

    bazz
    Last edited by bazz; 06-27-2009 at 01:29 AM.
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link


 

Posting Permissions

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