note 11769 modified in function.pg-fetch-array by felipe

From: Date: Tue, 22 Jul 2008 18:57:12 +0000
Subject: note 11769 modified in function.pg-fetch-array by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142531@lists.php.net to get a copy of this message
In addition to returning "false if there are no more rows", pg_fetch_array will also trigger an E_WARNING. You can temporarily turn that error reporting level off and suck out all your data like so: <?php $errRptLvl = error_reporting(); error_reporting($errRptLvl & ~(E_WARNING)); list($i,$j)=array(0,0); while ($selection[$i++] = $this->fetchArray($j++)); // (fetchArray is a pg_fetch_array wrapper.) error_reporting($errRptLvl); // Restore error reporting level. unset($selection[$i-1]); // Delete the last, empty row. return $selection; ?> --was-- In addition to returning "false if there are no more rows", pg_fetch_array will also trigger an E_WARNING. You can temporarily turn that error reporting level off and suck out all your data like so: $errRptLvl = error_reporting(); error_reporting($errRptLvl & ~(E_WARNING)); list($i,$j)=array(0,0); while ($selection[$i++] = $this->fetchArray($j++)); // (fetchArray is a pg_fetch_array wrapper.) error_reporting($errRptLvl); // Restore error reporting level. unset($selection[$i-1]); // Delete the last, empty row. return $selection; http://php.net/manual/en/function.pg-fetch-array.php

« previous php.notes (#142531) next »