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:
$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:
$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)
}
Statement: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