Difference between mysql_fetch_array and mysql_fetch_row?

前端 未结 10 1389
野的像风
野的像风 2020-12-02 08:36

This is a simple question for PHP users. The reason I couldn\'t get the the exact difference between mysql_fetch_array() and mysql_fetch_row() in P

10条回答
  •  感动是毒
    2020-12-02 09:32

    Answer two from the first link you provided is correct. The comment said:

    "Instead both returns all the rows from table. The difference between them is fetch_array return result in assoc array as well as numeric array and you can also specify which specific type of array you want by providing second parameter to the function while fetch_row return result in numeric array only."

    ... so using fetch_row you can't do something like

    echo $result['name']; // can do this in fetch_array, not in fetch_row
    echo $result[0]; // can do this in fetch_array and fetch_row
    

提交回复
热议问题