MySQL数组函数--mysql_fetch_array()

数据库 MySQL
MySQL中有很多功能强大的函数,下面为您介绍的函数mysql_fetch_array()属于MySQL数组函数,如果您对此感兴趣,不妨一看。

MySQL有一类独特的函数,称为MySQL数组函数,下面为您介绍的就是其中的MySQL数组函数--mysql_fetch_array()。

mysql_fetch_array 从结果集中取得一行作为关联数组,或数字数组,或二者兼有。

依次调用此函数也会返回结果集的下一行。

该MySQL数组函数语法:mysql_fetch_array(resource result, result type)

返回结果一般为:
 Array ( [0] => 1 [ID] => 1 [1] => 58.215.76.161 [IP] => 58.215.76.161 [2] => linux [description] => linux [3] => 1 [4] => http [protocol] => http [5] => 80 [port] => 80 [6] => http [7] => check_http [command] => check_http )

如果只需要关联数组则命令参数为
  mysql_fetch_array($rs,MYSQL_ASSOC) 相当于函数mysql_fetch_assoc()。

返回结果为

Array ( [ID] => 1 [IP] => 58.215.76.161 [description] => linux [protocol] => http [port] => 80 [command] => check_http )

如果只需要数字数组则命令参数为

mysql_fetch_array($rs,MYSQL_NUM) 相当于函数mysql_fetch_row().

返回结果为

Array ( [0] => 1 [1] => 58.215.76.161 [2] => linux [3] => 1 [4] => http [5] => 80 [6] => http [7] => check_http )

 

 

【编辑推荐】

MySQL日期的相关函数介绍

带您深入了解MYSQL Cast函数

查看三种MySQL字符集的方法

查看MySQL默认字符集

MySQL外键在数据库中的作用

 

责任编辑:段燃 来源: 互联网
相关推荐

2009-12-07 19:06:20

PHP mysql_f

2010-06-04 14:10:09

MySQL_fetch

2010-10-11 16:05:37

mysql表单

2009-11-16 15:07:23

PHP数组函数库

2011-03-30 16:15:53

Array数组

2009-11-24 17:52:46

PHP函数in_arr

2009-11-24 17:45:47

PHP数组排序函数ar

2009-11-25 14:44:34

PHP函数array_

2009-11-24 18:08:39

PHP函数array_

2009-11-24 18:18:21

PHP函数array_

2010-11-25 11:01:33

MySQL日期函数

2010-10-11 16:19:30

Mysql聚合函数

2010-10-14 14:01:35

MySQL CONVE

2009-11-25 16:40:55

PHP函数array_

2009-11-24 18:28:44

PHP函数array_

2010-05-27 13:26:20

MySQL日期时间函数

2010-06-13 10:18:08

MySQL 数据库函数

2010-10-11 16:23:35

MYSQL BENCH

2010-10-09 16:18:43

MYSQL IFNUL

2010-10-11 15:08:44

MySQL conca
点赞
收藏

51CTO技术栈公众号