note 60168 deleted from function.mysql-fetch-array by philip

From: Date: Wed, 26 Feb 2014 00:14:12 +0000
Subject: note 60168 deleted from function.mysql-fetch-array by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-198724@lists.php.net to get a copy of this message
Note Submitter: andrea at 3site dot it ---- alternative mysql_fetch_all // array mysql_fetch_all(query:resource [, kind:string (default:'assoc' | 'row')]) function mysql_fetch_all($query, $kind = 'assoc') { $result = array(); $kind = $kind === 'assoc' ? $kind : 'row'; eval('while(@$r = mysql_fetch_'.$kind.'($query)) array_push($result, $r);'); return $result; } // Example $query = mysql_query($myquery) or die(mysql_error()); $result = mysql_fetch_all($query); echo '<pre>'.print_r($result, true).'</pre>';

« previous php.notes (#198724) next »