note 114478 added to function.pg-escape-string

From: Date: Tue, 25 Feb 2014 07:54:59 +0000
Subject: note 114478 added to function.pg-escape-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-198704@lists.php.net to get a copy of this message
You should prefer to use pg_query_params, i.e. use parameterized queries, rather than using pg_escape_string. Or use the newer PDO interface with its parameterized query support. If you must substitute values directly, e.g. in DDL commands that don't support execution as parameterized queries, do so with pg_escape_literal: http://au1.php.net/manual/en/function.pg-escape-literal.php Identifiers can't be used as query parameters. Always use pg_escape_identifier for these if they're substituted dynamically: http://au1.php.net/manual/en/function.pg-escape-identifier.php You should not need to change text encodings when using this function. Make sure your connection's client_encoding is set to the text encoding used by PHP, and the PostgreSQL client driver will take care of text encodings for you. No explicit utf-8 conversions should be necessary with a correctly set client_encoding. ---- Server IP: 113.20.13.217 Probable Submitter: 106.68.6.206 ---- Manual Page -- http://php.net/manual/en/function.pg-escape-string.php Edit -- https://master.php.net/note/edit/114478 Del: integrated -- https://master.php.net/note/delete/114478/integrated Del: useless -- https://master.php.net/note/delete/114478/useless Del: bad code -- https://master.php.net/note/delete/114478/bad+code Del: spam -- https://master.php.net/note/delete/114478/spam Del: non-english -- https://master.php.net/note/delete/114478/non-english Del: in docs -- https://master.php.net/note/delete/114478/in+docs Del: other reasons-- https://master.php.net/note/delete/114478 Reject -- https://master.php.net/note/reject/114478 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#198704) next »