mysql_fetch_array() not working as expected

From: Date: Tue, 07 Oct 2003 18:29:37 +0000
Subject: mysql_fetch_array() not working as expected
Groups: php.general 
Request: Send a blank email to php-general+get-165344@lists.php.net to get a copy of this message
Hey peeps. Let me make this simple. I've got the following sql query in a function: SELECT c.id , cc.id , cc.prod_id , p.name , cc.price , cc.qty FROM cart AS c INNER JOIN cart_contents AS cc ON cc.cart_id = c.id INNER JOIN products AS p ON p.id = cc.prod_id WHERE c.cust_id = '6' ORDER BY cc.id When I get the result and turn it into an array with mysql_fetch_array($var, MYSQL_BOTH) I see the following with print_r(): Array ( [0] => Array ( [0] => 2 [id] => 3 [1] => 3 [2] => SDG6004-XX-XXX [prod_id] => SDG6004-XX-XXX [3] => Model 6004 [name] => Model 6004 [4] => 89.00 [price] => 89.00 [5] => 2 [qty] => 2 ) ) Notice that index 1 does not have a textual companion like the other indexes do. I expected the array to be created like this: Array ( [0] => Array ( [0] => 2 [c.id] => 3 [1] => 3 [cc.id] => 3 [2] => SDG6004-XX-XXX [cc.prod_id] => SDG6004-XX-XXX [3] => Model 6004 [p.name] => Model 6004 [4] => 89.00 [cc.price] => 89.00 [5] => 2 [cc.qty] => 2 ) ) But alas... that's not how it works. Anyway to get what I want? Thanks, Chris.

« previous php.general (#165344) next »