Is there PHP mysql_real_escape_string for postgresql?
See pg_escape_string
at http://www.php.net/manual/en/function.pg-escape-string.php.
Alternatively you could use prepared statements (pg_prepare) and placeholders ($1
, $2
, etc), and then give the arguments for the query in pg_execute. This would be my preferred way as it's not only cleaner, but also safer in the long run since there's no chance for SQL injections if you always use placeholders in prepared statements.