note 1140 deleted from ref.oracle by sniper
| From: | sniper@php.net | Date: | Mon, 11 Aug 2003 05:08:41 +0000 |
| Subject: | note 1140 deleted from ref.oracle by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-53845@lists.php.net to get a copy of this message | ||
Note Submitter: w.hartley@qut.edu.au
----
<pre>
Since ora_numrows always will return a 0,
The code above could be written as follows;
By saying while ora_fetch do, the fetch will keep grabbing
eah consecutive row until false.
Doing a COUNT(*) is poor coding.
<?
putenv("ORACLE_SID=ORACLE");
putenv("ORACLE_HOME=/opt/oracle/oracle/8.0.3");
$conn = ora_logon("scott", "tiger");
$curs = ora_open($conn);
ora_commitoff($conn);
$query = sprintf("select * from cat");
ora_parse($curs, $query);
ora_exec($curs);
$ncols = ora_numcols($curs);
while (ora_fetch($curs))
{
for ($i=0; $i<$ncols; $i++)
{
printf("%s = %s", ora_columnname($curs,$i), ora_getcolumn($curs,$i));
printf("<br>");
}
}
ora_close($curs);
ora_logoff($conn);
?>
Hope that helps
Wayne Hartley
Teaching and Learning Support Services
Queensland University of Technology
Brisbane, Queensland
Australia, 4000
</pre>