mysql_fetch_array returns duplicate data

前端 未结 7 1469
谎友^
谎友^ 2020-12-02 00:25

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

Array
(
    [0] => 1
    [row_id] => 1
    [1] =>         


        
7条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-02 01:01

    mysql_fetch_array() returns an array containing both associative keys (the field names specified by queries) and integer position key (i.e. 0 is first field, 1, is second, etc.). This is for convenience in accessing the data by either method.

    if you only want the named keys, you should use mysql_fetch_assoc() or better yet, use the mysqli functions as everyone on here will lambast you for using the old mysql_* functions.

提交回复
热议问题