韩顺平php mysql扩展库调取数据库表行数的三种方法

在这里插入图片描述
r e s m y s q l f e t c h r o w ( res获取行数据的时候,处理mysql_fetch_row( res),还有三种方法分别是
mysql_fetch_row( r e s ) m y s q l f e t c h a s s o c ( res) 返回一个索引的数组(推荐)(下一行) mysql_fetch_assoc( res)返回一个关联数组
mysql_fetch_array( r e s ) m y s q l f e t c h o b j e c t ( res)返回索引数组和关联数组(两套) mysql_fetch_object( res)把一行数据,当做一个对象返回

mysql_fetch_assoc($res)返回一个关联数组
在这里插入图片描述

在这里插入图片描述
mysql_fetch_array($res)返回索引数组和关联数组(两套)
在这里插入图片描述
在这里插入图片描述

mysql_fetch_object($res)把一行数据,当做一个对象返回
在这里插入图片描述
在这里插入图片描述
注意对象输出
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_43345480/article/details/89522551
今日推荐