I'm am trying to run a query in a Logic Hook and I am using a field from the CRM that could contain ' so I need to escape this in the query so the SQL syntax is correct. I tried the following but Sugar is escaping my escapes I beleive.
PHP Code:
$name = str_replace("'","\'",$bean->name);
$query = 'SELECT * FROM table WHERE name = $name AND number = "'.$bean->number.'"';
Should I be using a different function to escape my name field.
Rgds
Chris
**********************************
Sloved
**********************************
Using $bean->db->quote($bean->name) I was able to correctly add my escape characters as required by Mysql.
Bookmarks