craygo Posted April 6, 2006 Share Posted April 6, 2006 I have a table with about 40 fields What I want to do is loop thru the field names and values and print them to the screen edit them. So i have a row with id#2, I want to return each field name and the value for that field name in a loop.Ray Quote Link to comment https://forums.phpfreaks.com/topic/6699-field-name-and-value/ Share on other sites More sharing options...
Barand Posted April 6, 2006 Share Posted April 6, 2006 if you use[code]$row = mysql_fetch_assoc($result);[/code]then $row is an array of field values whose key is the field name[code]foreach ($row as $fname => $value) { echo "$fname : $value<br>";}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/6699-field-name-and-value/#findComment-24630 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.