How do I iterate over fields when I perform the below script:


each row has: artist_name,urlPath,biography as fields

while ($row = mysql_fetch_assoc($result))
{

# if the current field name  is 'artist_name', do something
switch($GetCurrentFieldNameintheCurrentRow)
 {
        case $row[ 'field name is now: artist_name']
        //do something
        break;
 }

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";
        }


many thanks :)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to