Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pear DB getAssoc. Return column name as keys

Status
Not open for further replies.

thedaver

IS-IT--Management
Jul 12, 2001
2,741
US
When I build a query and run a Pear DB call to 'getAssoc($sql)' I get back an array with numeric keys to the array.

array ( [0]=>"result1", [1]=>"result2", [2]=>"result3" )

What I had expected was:

array ( ["field1"]=>"result1", ["field2"]=>"result2", ["field3"]=>"result3" )


I wanted to shortcut the process of:
$res=$dbh->query($sql)
while ($row=$res->fetchRow(DB_FETCHMODE_ASSOC)) {
$array[]=$row;
}

What am I missing?! Thx. D.

Surfinbox.com Business Internet Services - National Dialup, DSL, T-1 and more.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top