note 88377 added to function.mysql-fetch-array

From: Date: Wed, 21 Jan 2009 17:12:35 +0000
Subject: note 88377 added to function.mysql-fetch-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-149604@lists.php.net to get a copy of this message
In response to KingIsulgard, a better one line way to put all results from the SELECT query in an array. <?php // Read records $result = mysql_query('SELECT * FROM table') or die(mysql_error()); // Put them in an array for(; $line = mysql_fetch_assoc($result); $array[] = $line); ?> This way, no need to delete the last line, $array is only pushed with necessary data. ---- Server IP: 89.31.146.176 Probable Submitter: 194.250.235.134 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-array.php Edit -- https://master.php.net/note/edit/88377 Del: integrated -- https://master.php.net/note/delete/88377/integrated Del: useless -- https://master.php.net/note/delete/88377/useless Del: bad code -- https://master.php.net/note/delete/88377/bad+code Del: spam -- https://master.php.net/note/delete/88377/spam Del: non-english -- https://master.php.net/note/delete/88377/non-english Del: in docs -- https://master.php.net/note/delete/88377/in+docs Del: other reasons-- https://master.php.net/note/delete/88377 Reject -- https://master.php.net/note/reject/88377 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#149604) next »