mysqli_fetch_assoc()和mysqli_fetch_array()的区别与用法

mysql_fetch_assoc 得到的是关联数组

mysql_fetch_array 可以得到关联数组也可以得到索引数组,也可以二者都有。

假如从数据库取出一个用户的用户名和密码

username password

test 123456

用assoc 结果是array([username]=>'test',[password]=>'123456')

用array 根据参数不同结果可能是以下三种之一

array([username]=>'test',[password]=>'123456')

array([0]=>'test',[1]=>'123456')

array([username]=>'test',[password]=>'123456',[0]=>'test',[1]=>'123456')

具体用哪个,根据你的需要来使用

猜你喜欢

转载自blog.csdn.net/qq_38845858/article/details/81534457