Jump to content

Archived

This topic is now archived and is closed to further replies.

craygo

Field Name and value

Recommended Posts

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

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.