mysql_fetch_array returns duplicate data

Viewed 8825

every time i run mysql_fetch_array an array is returned with duplicate values e.g.

Array
(
    [0] => 1
    [row_id] => 1
    [1] => some text
    [first_field] => some text
    [2] => some text
    [second_field] => some text 
}

but I only want single results in the array, I have tried using

mysql_fetch_array($data, MYSQL_ASSOC);

But this makes no difference.

7 Answers

The mysql_fetch_array() returns indexed as well as associative array. However mysql_fetch_assoc() returns only associative-array.

When mysql_fetch_array used with MYSQLI_NUM parameter returns only an indexed array. Example: mysql_fetch_array($resultset,MYSQLI_NUM)

Related