php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15111 mysql_fetch_array() returns bad array
Submitted: 2002-01-18 23:59 UTC Modified: 2002-01-19 03:33 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: compman86 at home dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.1.1 OS: Windows 2000
Private report: No CVE-ID: None
 [2002-01-18 23:59 UTC] compman86 at home dot com
I have a table with 10 columns. I queried the mysql database to return only 5. I used mysql_fetch_array($queryID) to get an array of data to work with. When I did count(mysql_fetch_array($queryid)) it returned 8. When I did mysql_num_fields($queryid) it returned 5. Also, when I try to access the array returned from mysql_fetch_array as a numeric array, it doesn't work. It doesn't give warnings, but it doesn't give any data. Here is some sample code:

$qid = mysql_query("SELECT a,b,c,d,e FROM table1");
echo mysql_fetch_array($qid);
echo mysql_num_fields($qid);
echo count(mysql_fetch_array($qid));

Thankyou for your time! =)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-19 03:33 UTC] sander@php.net
mysql_fetch_array contains each field twice (numeric, and with fieldnames). RTM on mysql_fetch_row, mysql_fetch_array, and mysql_fetch_assoc.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 22:01:28 2024 UTC