Home > php教程 > php手册 > php sybase_fetch_array使用方法

php sybase_fetch_array使用方法

WBOY
Release: 2016-06-13 09:37:55
Original
1090 people have browsed it

返回数组资料。
语法: array sybase_fetch_array(int result);
返回值: 数组
函数种类: 数据库功能
内容说明
本函数用来将查询结果 result 拆到数组变量中。若 result 没有资料,则返回 false 值。而本函数可以说是 sybase_fetch_row() 的加强函数,除可以将返回列及数字索引放入数组之外,还可以将文字索引放入数组中。
使用范例
这是 joey@samaritan.com (22-Feb-1999) 所提出的例子

实例1:

复制代码 代码如下:


$q = sybase_query("SELECT COUNT(DISTINCT OPPORTUNITY_ID) FROM M_OPP_INTERESTS WHERE INTEREST_ID = $i_id", $db);
while ($op_by_int = sybase_fetch_array($q)) {
while (list($k, $v) = each($op_by_int)) {
echo "\$op[$k] => $v\n";
}
?>

返回资料如下

$op[0] => 2164
$op[computed] => 2164

实例2:

复制代码 代码如下:


$dbh = sybase_connect('SYBASE', '', '');
$q = sybase_query('SELECT * FROM p, a WHERE p.person_id= a.person_id');
var_dump(sybase_fetch_array($q));
sybase_close($dbh);
?> 


The above example would produce the following output (assuming the two tables only have each one column called "person_id"):

复制代码 代码如下:


array(4) {
  [0]=>
  int(1)
  ["person_id"]=>
  int(1)
  [1]=>
  int(1)
  ["person_id1"]=>
  int(1)
}

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template