PHP Sybase_fetch_array use Method _php Foundation

Source: Internet
Author: User

Returns the 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 result of a query into an array variable. Returns the value of False if result has no data. This function can be said to be a sybase_fetch_row (), in addition to the return column and the numeric index can be placed in the array, you can also put the text index into the array.
Usage examples
This is an example of joey@samaritan.com (22-feb-1999)

Example 1:

Copy Code code as follows:

<?php
$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 (the list ($k, $v) = each ($op _by_int)) {
echo "\ $op [$k] => $v \ n";
}
?>

The return information is as follows

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

Example 2:

Copy Code code as follows:

<?php
$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 following output (assuming the two tables only have each one column called "person_id" ):

Copy Code code as follows:

Array (4) {
[0]=>
Int (1)
["person_id"]=>
Int (1)
[1]=>
Int (1)
["Person_id1"]=>
Int (1)
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.