Problem saving single quote in sc field with pg db

Hello,

I’m trying to solve this issue since a very long time. I’m not able to save single quote (’) in a text field with Postgres db. When I hit save I get a conformation that the field is updated but reverts back to the old text with no change. The form is accessing a couple of table and I’m using an Ajax event to update the field:

if (empty({col}))
{
$update_col = “UPDATE udbown.table SET col= null WHERE elyr =’”.{yr}."’ and elday= ‘".{Eday}."’ and st = ‘".{st}."’";
}
else
{
$update_col = “UPDATE udbown.table SET col=’”.{col}."’ WHERE elyr =’".{yr}."’ and elday= ‘".{Eday}."’ and st = ‘".{st}."’";
}

sc_exec_sql($update_col);

Any help is greatly appreciated.

Thank you.

Never mind found the solution.

Hi,
Try with php addslashe($string)