|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62879 Incorrect Array Size when fetching Array
Submitted: 2012-08-21 16:03 UTC Modified: 2012-08-21 16:13 UTC
From: joseph dot morain at live dot ca Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: joseph dot morain at live dot ca
New email:
PHP Version: OS:


 [2012-08-21 16:03 UTC] joseph dot morain at live dot ca
Hi I'm using PHP 5.4.4 (Didn't see option for this).

I have a trivial table called staff with 3 rows and 1 record 

staff_id : 555
email :
password : 1_b@c0n@73_8Ab1Es

whenever I try to fetch array however it multiplies the data by 2!
I've posted a short little program which illustrates my problem. 

There is a similar problem here :
but it was dealing with a slightly different function so I didn't append that 
bug report. 

Test script:
$con = dbopen();
$results = mysqli_query($con,'SELECT  * FROM Staff;');
while($row = mysqli_fetch_array($results)){
	foreach($row as $t){
		echo $t.'<br/>';

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-08-21 16:13 UTC]
-Status: Open +Status: Not a bug
 [2012-08-21 16:13 UTC]
mysqli_fetch_array() by default gives you both numeric and associative indices 
for each row. Pass in MYSQLI_ASSOC or MYSQLI_NUM to get just one of them.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Oct 03 05:05:53 2022 UTC