Home > php教程 > php手册 > body text

php sybase_fetch_array usage method_php basics

WBOY
Release: 2016-05-16 08:59:53
Original
3349 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] => $v\n";
}
?>
P>

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)
}
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