I'm having some trouble with Pear DB, if anyone can help me out, I'd appreciate it. It concerns fetching a specific row inside a result.
I'm using the pear version included in PHP 4.04
<?php
require_once 'DB.php';
$dsn = "oci8://userass@host";
$db = DB::connect($dsn);
if (DB::isError($db)) { die ($db->getMessage()); }
$sql = "select * from dca_catmaster";
$result = $db->query($sql);
if (DB::isError($result)) { die ($result->getMessage()); }
echo "Selected. <br>";
// This prints out "Object" on the screen.
echo $result->numRows();
$rowNum = 0;
// if I do this, I'm fine. I get my data, ugly as it is.
/* while ($row = $result->fetchRow()) {
foreach($row as $column){ echo "$column<br>"; }
}
*/
// This, however, always gives me the following:
/*
1
1024
-9
DB Error: DB backend not capable
select * from dca_catmaster
*/
foreach (range(0, 10) as $rownum) {
if (!$row = $result->fetchRow($fetchmode, $rownum)) { break; }
foreach($row as $column){ echo "$column<br>"; }
}
$db->disconnect();
?>
I'm using the pear version included in PHP 4.04
<?php
require_once 'DB.php';
$dsn = "oci8://userass@host";
$db = DB::connect($dsn);
if (DB::isError($db)) { die ($db->getMessage()); }
$sql = "select * from dca_catmaster";
$result = $db->query($sql);
if (DB::isError($result)) { die ($result->getMessage()); }
echo "Selected. <br>";
// This prints out "Object" on the screen.
echo $result->numRows();
$rowNum = 0;
// if I do this, I'm fine. I get my data, ugly as it is.
/* while ($row = $result->fetchRow()) {
foreach($row as $column){ echo "$column<br>"; }
}
*/
// This, however, always gives me the following:
/*
1
1024
-9
DB Error: DB backend not capable
select * from dca_catmaster
*/
foreach (range(0, 10) as $rownum) {
if (!$row = $result->fetchRow($fetchmode, $rownum)) { break; }
foreach($row as $column){ echo "$column<br>"; }
}
$db->disconnect();
?>