请问mysql_fetch_assoc与mysql_fetch_array有何区别?

2009-08-11 23:53:26 by 【6yang】, 75 visits, 收藏 | 返回
mysql_fetch_assoc()和mysql_fetch_array($result,MYSQL_ASSOC)是一个效果,就是取得关联数组,数组下标一般为字符
而mysql_fetch_array($result,MYSQL_NUM)取到的数组,数组下标为数字
这个是
mysql_fetch_assoc
Array
(
    [productid] => 9
    [providerid] => 1
    [productname] => asdfasd
    [version] => afasdf
    [environment] => asdfasdf
    [productsize] => asdfasdf
    [Lastupdate] => 2007-12-03 04:43:07
    [producturl] => asdfasd
    [downloadurl] => asdfasdf
    [logo] => 071203044307392.jpg
    [picurl] => 071203044307329.jpg
    [description] => asdfasdf
)
这个是fetch_arrayArray
(
    [0] => 9
    [productid] => 9
    [1] => 1
    [providerid] => 1
    [2] => asdfasd
    [productname] => asdfasd
    [3] => afasdf
    [version] => afasdf
    [4] => asdfasdf
    [environment] => asdfasdf
    [5] => asdfasdf
    [productsize] => asdfasdf
    [6] => 2007-12-03 04:43:07
    [Lastupdate] => 2007-12-03 04:43:07
    [7] => asdfasd
    [producturl] => asdfasd
    [8] => asdfasdf
    [downloadurl] => asdfasdf
    [9] => 071203044307392.jpg
    [logo] => 071203044307392.jpg
    [10] => 071203044307329.jpg
    [picurl] => 071203044307329.jpg
    [11] => asdfasdf
    [description] => asdfasdf
)

效率应该取得少的快吧,呵呵
分享到:
share

    图片原图

    loading

    loading