perl -> php PDO newbie question

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I know I'm over looking something simple, so maybe somene here can help
me out.

I'm unsuccessfully trying to dereference an element of an array. I'm
trying to get the name of a PDO database column.

$rows->getColumnMeta($recNumber) will return an array with all my db
col details.

array(6) {
  string(2) "id"

I want to be able to get the column name  (name=>id) in element in 1
statement: Something like:

print "name = : " . $rows->getColumnMeta($recNumber)['name'] . " \n";

But this does not work.
Instead I've been forced to use the much less elegant:

$tmp =  $rows->getColumnMeta($recNumber);
$colName = $tmp['name'];

This works but I know that there is a better way of doing this.
Any suggestions would be appreciated.


Site Timeline