RE: Array

From: Date: Mon, 29 Oct 2001 12:34:03 +0000
Subject: RE: Array
Groups: php.general 
Request: Send a blank email to php-general+get-72709@lists.php.net to get a copy of this message
This seems way too complicated. I do this sort of thing all the time from a mysql db. I've no idea where you're getting the data from but if it was from a mysql db I'd just do $result = mysql_query("SELECT field1, field2, field3, field4 FROM tablename WHERE condition"); while ($array = Mysql_fetch_array($result)) $values[] = $array; ... you van then do ... foreach($values as $row) { echo(" {$row["field1"]}, {$row["field1"]}, {$row["field1"]}<br>"); // or whatever you want to do } Tim Ward ---------- From: De Necker Henri [SMTP:deNeckerH@ford.co.za] Sent: 29 October 2001 07:26 To: PHP-General (E-mail) Subject: RE: Array Now i did the following : My output is only null or blank values!,but my data is there! while($row=db_range()){ list($co_id,$surname,$init,$ba) = $row; echo "$co_id $surname<br>"; # This works perfect! $values[$i]['id'] = $co_id; $values[$i]['surname'] = $surname; $values[$i]['init'] = $init; $values[$i]['ba'] = $ba; $cid = $values[$i]['id']; echo "$id<br>" ; # Doesnt wanna work list($a,$b,$c,$d) = $values[$i]; echo "$a" ; # Doesnt wanna work $i++; }//end while 1

« previous php.general (#72709) next »