note 54058 deleted from function.mysql-query by mazzanet

From: Date: Sun, 02 Oct 2005 13:45:59 +0000
Subject: note 54058 deleted from function.mysql-query by mazzanet
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-96185@lists.php.net to get a copy of this message
Note Submitter: javier dot alpizar at gmail dot com ---- This is a function to return an associative or number indexed array. I hope this will help anyone, saving a lot of lines .... If the query was empty, returns false. Note: always will return a array with one index, if the query result was only one row <? function exec_return_array($query,$mode=MYSQL_BOTH){ //Executes the query $resource = mysql_query($query); //Count the rows if(mysql_num_rows($resource) > 0){ //'Resultset' $result = array(); while ($row = mysql_fetch_array($resource,$mode)){ $result[] = $row; }//end while return $result; }//end if return false; }//end function ?>

« previous php.notes (#96185) next »