Home > Backend Development > PHP Tutorial > How to use php sybase_fetch_array_PHP tutorial

How to use php sybase_fetch_array_PHP tutorial

WBOY
Release: 2016-07-13 10:32:45
Original
787 people have browsed it

Return array data.
Syntax: array sybase_fetch_array(int result);
Return value: array
Function type: Database function
Content description
This function is used to split the query result result into an array variable. If result has no data, a false value is returned. This function can be said to be an enhanced function of sybase_fetch_row(). In addition to putting the returned column and numeric index into the array, you can also put the text index into the array.
Usage Example
This is an example submitted by joey@samaritan.com (22-Feb-1999)

Example 1:

Copy code The code is as follows:

$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] => $vn";
}
?>

The return information is as follows

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

Example 2:

Copy code The code is as follows:

$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"):

Copy code The code is as follows:

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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/754796.htmlTechArticleReturns array data. Syntax: array sybase_fetch_array(int result); Return value: array Function type: Database function Content description This function is used to split the query result result into an array...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template