Re: [PHP] how to iterate over fields names with mysql_fetch_assoc

2004-06-20 Thread franciccio
Something easier: while ($row=mysql_fetch_assoc($result)) { foreach ($row as $k=> $val) { switch ($k) { case 'artist_name': // do sometihing here, you may want to use $val; break; case 'urlPath': // do something here you may w

Re: [PHP] how to iterate over fields names with mysql_fetch_assoc

2004-06-19 Thread grahama
thanks...that is what I had used previously :) Another php coder had given me a hint that I could just take each incoming row on the fly with $row['artist_name'] without reading everything into an array: What I had previously was: while ($row = mysql_fetch_assoc($result)) { $playlist[] = $ro

Re: [PHP] how to iterate over fields names with mysql_fetch_assoc

2004-06-19 Thread Robin Vickery
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

[PHP] how to iterate over fields names with mysql_fetch_assoc

2004-06-19 Thread grahama
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 i