mysql fetch assoc VS mysql fetch array

后端 未结 10 1879
太阳男子
太阳男子 2020-12-10 04:10

Below are two methods commonly used in most php codes for fetch mysql data .

  1. mysql_fetch_array()
  2. mysql_fetch_assoc()
  3. <
10条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-10 05:11

    mysql_fetch_assoc() would probably be the better choice. There is a slight performance hit (the mysql extension needs to look up the column names, but that should only happen once, no matter how many rows you have), but probably not enough to justify using mysql_fetch_array() instead. mysql_fetch_array() can be useful if you're only selecting one column though.

提交回复
热议问题