Hello all,

I'm grabbing all records from a table using:

$records = $stmt->fetchAll(PDO::FETCH_OBJ);
return $records;

In order to display the values we can do:

foreach ($records as $record)
                echo $record->id;
                echo $record->name;

However, I'd like to grab, also, the *column names*.

I've tried:

foreach ($records as $column=>$value)
        echo "$column is $value\n";

But I get:
"Catchable fatal error: Object of class stdClass could not be converted to

Can I have your help on how can I properly get the column values?


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

Reply via email to