Edit report at https://bugs.php.net/bug.php?id=62879&edit=1

 ID:                 62879
 Updated by:         ras...@php.net
 Reported by:        joseph dot morain at live dot ca
 Summary:            Incorrect Array Size when fetching Array
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            MySQLi related
 Operating System:   Linux
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[2012-08-21 16:03:14] joseph dot morain at live dot ca

Description:
------------
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 : baconator_k...@baconation.com
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 : https://bugs.php.net/bug.php?id=60333
but it was dealing with a slightly different function so I didn't append that 
bug report. 




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

Expected result:
----------------
555
baconator_k...@baconation.com
1_b@c0n@73_8Ab1Es

Actual result:
--------------
555
555
baconator_k...@baconation.com
baconator_k...@baconation.com
1_b@c0n@73_8Ab1Es
1_b@c0n@73_8Ab1Es


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62879&edit=1

Reply via email to