note 21301 deleted from function.pg-query by cmb

From: Date: Mon, 09 Aug 2021 13:50:44 +0000
Subject: note 21301 deleted from function.pg-query by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-216758@lists.php.net to get a copy of this message
Note Submitter: david dot bouriaud at ac-rouen dot fr ---- 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 !!!

« previous php.notes (#216758) next »