View Full Version : Resolved problem matching values with apostrophe

06-27-2009, 01:24 AM

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 :confused:

what way should I change the query please?

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.