note 34603 rejected from function.mysql-fetch-array by didou
| From: | didou@php.net | Date: | Thu, 31 Jul 2003 23:18:25 +0000 |
| Subject: | note 34603 rejected from function.mysql-fetch-array by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-53120@lists.php.net to get a copy of this message | ||
Note Submitter: phpContrib (A T) esurfers d o t c o m
----
If you like to keep the numeric values and the associative key values (they both might come handy),
you can use the Array returned by mysql_fetch_array() in both ways, just remember a few things:
// Associative: remember to skip numeric keys!
foreach($Vals as $FieldName => $FieldVal) {
if((is_int($FieldName))) continue; // Skip Numeric Indexing
// ...
}
// Numeric: remember not to use cont(..) or divide it by 2
$Length=count($Vals)/2;
for(int $i=0;$i<$Length;$i++) {
$FieldVal=$Vals[$i];
// ...
}