note 104434 added to function.pg-query-params

From: Date: Wed, 15 Jun 2011 10:00:42 +0000
Subject: note 104434 added to function.pg-query-params
Groups: php.notes 
Request: Send a blank email to php-notes+get-180544@lists.php.net to get a copy of this message
You can't run multiple statements with pg_query_params, but you can still have transaction support without falling back to pg_query: <?php $connection = pg_connect("host=127.0.0.1 port=5432 dbname=foo user=bar password=baz"); pg_query($connection, 'DROP TABLE IF EXISTS example'); pg_query($connection, 'CREATE TABLE example (col char(1))'); pg_query($connection, 'INSERT INTO example (col) VALUES (\'a\')'); // 'SELECT col FROM example' in another session returns "a" pg_query($connection, 'BEGIN'); pg_query_params($connection, 'UPDATE example SET col = $1', array('b')); // 'SELECT col FROM example' in another session still returns "a" pg_query_params($connection, 'UPDATE example SET col = $1', array('c')); // 'SELECT col FROM example' in another session still returns "a" pg_query($connection, 'COMMIT'); // 'SELECT col FROM example' in another session returns "c" ?> ---- Server IP: 69.147.83.197 Probable Submitter: 84.73.54.61 ---- Manual Page -- http://www.php.net/manual/en/function.pg-query-params.php Edit -- https://master.php.net/note/edit/104434 Del: integrated -- https://master.php.net/note/delete/104434/integrated Del: useless -- https://master.php.net/note/delete/104434/useless Del: bad code -- https://master.php.net/note/delete/104434/bad+code Del: spam -- https://master.php.net/note/delete/104434/spam Del: non-english -- https://master.php.net/note/delete/104434/non-english Del: in docs -- https://master.php.net/note/delete/104434/in+docs Del: other reasons-- https://master.php.net/note/delete/104434 Reject -- https://master.php.net/note/reject/104434 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#180544) next »