Bug #10268 Updated: mysql_fetch_array() dropping non-NULL column name
| From: | sniper@php.net | Date: | Wed, 27 Jun 2001 13:56:23 +0000 |
| Subject: | Bug #10268 Updated: mysql_fetch_array() dropping non-NULL column name | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-58206@lists.php.net to get a copy of this message | ||
ID: 10268
Updated by: sniper
Reported By: clewis@myfonts.com
Old-Status: Closed
Status: Bogus
Bug Type: MySQL related
Operating system:
PHP Version: 4.0.4pl1
Assigned To:
Comments:
This is better as bogus.
Previous Comments:
---------------------------------------------------------------------------
[2001-06-27 02:55:50] derick@php.net
User error, so closing.
---------------------------------------------------------------------------
[2001-06-26 12:11:25] clewis@myfonts.com
Solved. This was happening due to a truly inspired problem with my own code... The element was
being unset deep in a separate function. Sorry to bother you!
---------------------------------------------------------------------------
[2001-04-10 13:34:47] clewis@myfonts.com
mysql_fetch_array with MYSQL_BOTH or MYSQL_ASSOC is returning one of the columns in the query ONLY
as a numeric index, but not the named index. The column is a NOT NULL column, so the value is
always defined.
I have a feeling the problem has something to do with the fact that the "missing" column
is the column joining two tables. Here's the SQL:
select distinct p.*,pt.Formula
from Promotions p, PromoTypes pt
where p.PromoTypeID = pt.PromoTypeID
Here's some of the result of mysql_fetch_array:
array(31) {
[0]=>
string(2) "10"
["PromotionID"]=>
string(2) "10"
[1]=>
string(20) "Free font with order"
["Name"]=>
string(20) "Free font with order"
...etc...
[7]=>
string(2) "10"
[8]=>
string(4) "0.01"
["X"]=>
string(4) "0.01"
...etc...
}
Array index 7 should be followed by the key "PromoTypeID". The same thing happens using
MYSQL_ASSOC (the element is missing altogther), and also if I specify p.PromoTypeID explicitly in
the query.
The problem IS SOLVED if I alias the column name to something else using "p.PromoTypeID AS
FakeName" , which makes me think even more that it's being confused by the table joining.
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=10268&edit=2