On Monday 28 July 2003 10:19, Ryan A wrote: > After asking for help on the list Skate gave me the following code as an > example: > ************** > $n = 0; > $result = mysql_query( "SELECT id, title, text, date FROM news ORDER BY > date DESC" ); > while ($rows = mysql_fetch_array($result)) { > if( $rows == "" ){ continue; } > extract( $rows ); ///extract our result into variables named after our > fields > $content[id][$n] = $id; > $content[title][$n] = $title; > $content[text][$n] = $text; > $content[date][$n] = $date; > $n++; //increment our number for next time... > } > ************** > My question is: is there anyway I can use a "select * from...." to do the > same thing and then dump as usual to > $content[id][$n] = $id; $content[title][$n] = $title; instead of a "select > id, title, text, date" because in reality I don't have just these 4 fields > but 43 fields in one table that have to be taken. "Select *..." seems a > much easier way to get it....
*** Untried and untested *** $query = "SELECT * FROM table"; $result = mysql_query($query) or die("Query failed"); $n = 0; while ($line = mysql_fetch_assoc($result)) { foreach ($line as $field => $value) { $data[$field][$n] = $value; } $n++; } print_r($data); Season to taste. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* What one believes to be true either is true or becomes true. -- John Lilly */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php