note 21301 added to function.pg-query

From: Date: Tue, 07 May 2002 14:54:41 +0000
Subject: note 21301 added to function.pg-query
Groups: php.notes 
Request: Send a blank email to php-notes+get-30294@lists.php.net to get a copy of this message
Hi to all ! It seems that the old pg_exec function does not do what it is expected to. In the doc, it is said that it returns a resource identifier on the successful querry that was send to the backend. It seems to me that it is more than a resource identifier. Follow the example : <?php $ConnId = pg_connect ("blablabla"); $ResId = pg_exec ("select * from table", $ConnId); pg_close ($ConnId); $row = pg_fetch_array ($ResId, 4); ?> I closed the connection voluntarily before the pg_fetch_array. It WORKS ! Now, imagine the following script : <?php $ConnId = pg_connect ("blablabla"); $ResId = pg_exec ("select * from table", $ConnId); pg_close ($ConnId); system ("psql base -c delete from table"); $row = pg_fetch_array ($ResId, 4); ?> See how it could be harmful !!!! I think that the coders have done this for performances reasons, but it is not the right way do do so !!! -- http://www.php.net/manual/en/function.pg-query.php http://master.php.net/manage/user-notes.php?action=edit+21301 http://master.php.net/manage/user-notes.php?action=delete+21301 http://master.php.net/manage/user-notes.php?action=reject+21301

« previous php.notes (#30294) next »