single quote in sql select statement

Hi,

I have 2 fields (name, project).

In the “name” field, under Ajax processing, I select “project” so that when I select name in the drop-down list, the corresponding project will be shown.

In the “project” field, it is a “Select” data type which I have input the following sql statement. I cannot show the value if there is a single quote in the name (eg. Alex’s). Can someone kindly advice how can I go about doing this? Thanks.

SELECT project FROM tableA WHERE name=’{name}’

If you have quotes or can have in your data then you need to escape them using http://php.net/manual/en/function.addslashes.php

In addition, I tried hardcode a name ABC’s Ltd in the where clause (eg. where clientname=“ABC’s Ltd”), the project value can actually display.

Not sure why {clientname} has issue?