On Sat, 19 Jun 2004 13:25:54 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > How do I iterate over fields when I perform the below script: ... > If I write the below code, I only get the first field name of each > row...which makes sense > In this case, I get 'artist_name' > > while ($row = mysql_fetch_assoc($result)) > { > $fieldName= key($row); > echo 'fieldName is: '.$fieldName."\n"; > }
<?php while ($row = mysql_fetch_assoc($result)) { foreach ($row as $fieldName => $fieldValue) { echo 'fieldName is: '.$fieldName."\n"; echo 'fieldValue is: '.$fieldValue."\n"; } } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php