pear and sybase

admin

Administrator
Staff member
I need help with the following problem. I am attempting to use the PEAR abstraction layer to read sybase tables.

I can connect to the database fine and navigate the table fine.
After all rows are returned using the fetchRow method, the execution continues looping and returning nothing until the script expiration time has beed reached.

Here is the code I am using:
<?
require_once 'DB.php';

$dsn = array (
'phptype' => 'sybase',
'hostspec' => 'xxxxxxxxx',
'database' =>'xxxxxxx',
'username' => 'xxxxxxxx',
'password' => 'xxxxxxxx');

if (DB::isError($db = DB::connect($dsn)))
die ("CONNECT failed: " . DB::errorMessage($db));

$db->setFetchMode (DB_FETCHMODE_ASSOC);

$sql = "select name, network_id from network";

if (DB::isError ($result = $db->query($sql)))
die ("<BR>SELECT failed: " . $result->getMessage() . "\n");

while ($row = $result->fetchRow())
printf ("%s, %s<BR>\n", $row["name"], $row["network_id"]);

$result->free();

$db->disconnect();
?>
 
Back
Top