mysql_fetch_assoc与mysql_fetch_array的区别
mysql_fetch_assoc与mysql_fetch_array的区别?
1. mysql_fetch_assoc : mysql_fetch_assoc() 函数从结果集中取得一行作为关联数组。返回根据从结果集取得的行生成的关联数组,如果没有更多行,则返回 false。
2.mysql_fetch_array :mysql_fetch_array() 是 mysql_fetch_row() 的扩展版本。除了将数据以数字索引方式储存在数组中之外,还可以将数据作为关联索引储存,用字段名作 为键名。
3. mysql_fetch_array -- 从结果集中取得一行作为关联数组,或数字数组,或二者兼有。注释:mysql_fetch_assoc() 和用 mysql_fetch_array() 加上第二个可选参数 MYSQL_ASSOC 完全相同。它仅仅返回关联数组。这也是 mysql_fetch_array() 初始的工作方式。即:mysql_fetch_array($result,'MYSQL_ASSOC')与mysql_fetch_assoc($result)返回结果相同,提示:如果在关联索引之外还需要数字索引,用 mysql_fetch_array()。
注释:本函数返回的字段名是区分大小写的。
mysql_fetch_assoc 得到的是关联数组。
mysql_fetch_array 可以得到关联数组也可以得到索引数组,也可以二者都有。
4.提示和注释
1. 注释:mysql_fetch_assoc() 和用 mysql_fetch_array() 加上第二个可选参数 MYSQL_ASSOC 完全相同。它仅仅返回关联数组。这也是 mysql_fetch_array() 初始的工作方式。
2. 提示:如果在关联索引之外还需要数字索引,用 mysql_fetch_array()。
3. 注释:本函数返回的字段名是区分大小写的
mysql_fetch_assoc与mysql_fetch_array的区别的更多相关文章
- 2019-07-24 PHP中mysql_fetch_assoc 和 mysql_fetch_array 有什么区别?
mysql_fetch_assoc() 函数从结果集中取得一行作为关联数组 来看下面的例子: 数据库中有上述几条数据,一般我们想取用就要按照如下代码: $con = mysql_connect('12 ...
- PHP中mysql_fetch_row()、mysql_fetch_assoc()和mysql_fetch_array()的联系
总是记不住或者混淆mysql_fetch_row().mysql_fetch_assoc()和mysql_fetch_array()这三个函数的朋友们注意了,今天我在这里给大家总结一下他们之间的关系, ...
- mysql_fetch_assoc 跟mysql_fetch_array 有什么区别?
mysql_fetch_assoc 得到的是关联数组. Array ( [0] => Array ( [title] => 特价9.9包邮 EFOLAR/依芙拉 BB粉润腮红粉 饼 蘑菇 ...
- 深入mysql_fetch_row()与mysql_fetch_array()的区别详解
这两个函数,返回的都是一个数组,区别就是第一个函数返回的数组是只包含值,我们只能$row[0],$row[1],这样以数组下标来读取数据,而mysql_fetch_array()返回的数组既包含第一种 ...
- 43)PHP,mysql_fetch_row 和mysql_fetch_assoc和mysql_fetch_array
mysql_fetch_row 提取的结果是没有查询中的字段名了(也就是没有键id,GoodsName,只有值),如下图: mysql_fetch_assoc 提取的结果有键值,如下图: mysq ...
- mysql_fetch_row,mysql_fetch_array,mysql_fetch_object,mysql_fetch_assoc的区别!
php从mysql中访问数据库并取得数据,取得结果的过程中用到好几个类似的方法,区别及用法值得区分一下,看下面的代码 代码如下: <?php $link=mysql_connect('loc ...
- 【转】mysql_fetch_row , mysql_fetch_array , mysql_fetch_assoc 的区别
<?php $link = mysql_connect('localhost', 'root', ”); mysql_select_db('abc', $link); $sql = “selec ...
- mysql_fetch_row,mysql_fetch_array,mysql_fetch_assoc的区别
<?php $link=mysql_connect('localhost','root',”); mysql_select_db('abc',$link); $sql = “select * f ...
- mysql_fetch_row,mysql_fetch_array,mysql_fetch_object,mysql_fetch_assoc区别
1.mysql_fetch_row 只能以索引下标取值,从0开始. 2.mysql_fetch_array 能以索引下标取值,也可以用字段名称取值. 3.mysql_fetch_object 对象方 ...
随机推荐
- c# Lambda扩展
扩展类 public static class LinqExtensions { /// <summary> /// 创建lambda表达式:p=>true /// </sum ...
- WebRequest请求错误(服务器提交了协议冲突. Section=ResponseHeader Detail=CR 后面必须是 LF)
WebRequest请求错误(服务器提交了协议冲突. Section=ResponseHeader Detail=CR 后面必须是 LF)解决办法,天津config文件,增加一个配置如下 <?x ...
- Oracle11超详细安装教程和配置
这篇博客主要是介绍一下Oracle数据的安装过程和简单的配置,帮助大家可以简单的让Oracle运行起来,只是一个基础的教程. 准备工作: 如果你以前装过Oracle数据库,而且安装目录要改变请先打开注 ...
- linux dll hell--链接库real name, soname, link name
DLL hell 是指 Windows 系统上动态库的新版本覆盖旧版本,且新版本不能兼容旧版本的问题. 例如:装新软件,但原有的软件运行不起来了. Linux 系统下也同样面临着和 Windows ...
- SYN2306C型 GPS北斗授时导航接收机
SYN2306C型 GPS北斗授时导航接收机 北斗对时系统北斗标准同步时钟北斗卫星校时器使用说明视频链接: http://www.syn029.com/h-pd-222-0_310_36_-1.htm ...
- Docker-CE 安装(centos7)
配置yum源 > cd /etc/yum.repos.d/ > mkdir repo_bak > mv *.repo repo_bak/ > wget http://mirro ...
- H5 离线缓存的用法
H5离线缓存基础系列 1.什么是离线缓存 离线缓存:离线缓存可以将站点的一些文件缓存到本地,它是浏览器自己的一种机制,将需要的文件缓存下来,以便后期即使没有连接网络,被缓存的页面也可以展示. 2. ...
- Redis Ubuntu 安装
1.使用 root 用户登录 Ubuntu 2. wget http://download.redis.io/releases/redis-5.0.3.tar.gz 下载最新的稳定版本到 redis ...
- ceph-fuse客户端问题排查流程
本文讲述了ceph-fuse客户端问题排查基本流程:) 首先查看集群的整体情况 ceph -s 是否有osd挂掉,是否有pg非active ceph-fuse进程是否存在? ps -ef |grep ...
- vue-cli初始化项目
vue init webpack cnpm install npm run dev 初始化项目 我们用vue init命令来初始化项目,具体看一下这条命令的使用方法. vue init <t ...