mysql_fetch_array returns duplicate data

This is the intended functionality of mysql_fetch_array(). If you want to not have the "duplicates" and just have the associative-array, use mysql_fetch_assoc() instead.

Example:

while ($row = mysql_fetch_assoc($data)) { ... }

mysql_fetch_array returns resultset returned as as response to query execution as both associative and numeric arrays. For returning resultset as associative array you need to use mysql_fetch_assoc function. For returning resultset as numeric array you need to use mysql_fetch_row function.

Tags:

Mysql

Php