|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10268 mysql_fetch_array() dropping non-NULL column name
Submitted: 2001-04-10 13:34 UTC Modified: 2001-06-27 09:56 UTC
From: clewis at myfonts dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.0.4pl1 OS: RedHat 6.1
Private report: No CVE-ID: None
 [2001-04-10 13:34 UTC] clewis at myfonts dot 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) {
  string(2) "10"
  string(2) "10"
  string(20) "Free font with order"
  string(20) "Free font with order"

  string(2) "10"
  string(4) "0.01"
  string(4) "0.01"


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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-26 12:11 UTC] clewis at myfonts dot 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-06-27 02:55 UTC]
User error, so closing.
 [2001-06-27 09:56 UTC]
This is better as bogus.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Feb 21 09:01:28 2024 UTC