Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

<?
//move to sixth row
sybase_data_seek($Result, 5);
?>


array sybase_fetch_array(integer result)


The sybase_fetch_array function returns an array that contains the values of all the
fields for the next row. Each call to sybase_fetch_array gets the next row in the result
set, or returns FALSE if no rows remain.


Each field is returned in two elements. One is indexed by the field number, starting with
zero. The other is indexed by the name of the field. Compare this function to
sybase_fetch_object and sybase_fetch_row.


<?
//connect
$Link = sybase_pconnect();


//use the store database
sybase_select_db("store", $Link);


//get all items
$Result = sybase_query("SELECT * FROM item ");


print("<TABLE BORDER=\"1\">\n");


//get rows
while($Row = sybase_fetch_array($Result))
{
print("\n");


print("". $Row["Name"]. "\n");


print("". $Row["Price"]. "\n");


print("\n");
}


print("\n");


?>


object sybase_fetch_field(integer result, integer field)


The sybase_fetch_field function returns an object that describes a field in the result
set. The field argument is optional. If left out, the next field is returned. The object

Free download pdf