Hey Jason, Thanks for that bit of code, it was exactly what i was looking for.
For those of you curious or face the same problem: After dumping the data into the array I am calling each part that i need via <?php echo $data['pname'][1]; ?> where "pname" in this case is the field name and the 1 is for the second value. (Damn, i love php, never worked with these kinds of arrays before and its still a snap.) one last question: According to the script I am calling an include file... eg: if(r=2){include "blah1.php";} elseif (r=3){include "blah2.php";} and so on.... now blah1,2,3 etc are mostly html code files with php in them.....will this slow down performance a lot and be much of a strain? the calling files are not large...maybe around 12k each...The reason I choose to go this way of course is for easier readibilty ,handleing and space management. Whats your experience with this? good or bad? Cheers, -Ryan ----- Original Message ----- From: "Jason Wong" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, July 28, 2003 4:46 AM Subject: Re: [PHP] Array help > 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 > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php