note 45607 deleted from function.pg-set-client-encoding by tomsommer

From: Date: Sun, 12 Sep 2004 21:32:51 +0000
Subject: note 45607 deleted from function.pg-set-client-encoding by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-76555@lists.php.net to get a copy of this message
Note Submitter: jmarcelo at gmx dot de ---- If you have experienced some problems with the encode type doing selects, inserts and updates and are getting back an error message like this: "invalid byte sequence for encoding 'UNICODE'". Try to use 'pg_set_client_encoding' before 'pg_query'. $name = "João Marcelo"; $last_name = "Bodè"; $user_id = "1234"; //whatever value // changes the client encode type to use a portuguese friend encode type pg_set_client_encoding("LATIN1"); $sql = "insert into user(name, last_name) where id_usuario = '$user_id'"; $res = pg_query($conn, $sql) or die(pg_last_error()); You can also do the same with selects and updates.

« previous php.notes (#76555) next »