make keys of a associative array DB field names?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Would anybody remind me how this should be achieved?

This returns all the names of the fields.

while( ($f = odbtp_fetch_field( $qry )) ) {
        echo $f->name . "\n";
    }

This returns the query results:

while( ($rec = odbtp_fetch_array($qry)) ) {
   foreach ($rec as $var) {
        echo "$var\n";
   }
}

How should I connect them together?  Say, the fields are 'name', 'age',
'score'.  I want to print out $rec['name'], $rec['age'] and $rec['score']
rather than using $rec[0], $rec[1] and $rec[2].

Thanks in advance for any ideas,

Bing

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux