note 1984 deleted from ref.oracle by sniper
| From: | sniper@php.net | Date: | Mon, 11 Aug 2003 05:08:32 +0000 |
| Subject: | note 1984 deleted from ref.oracle by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-53844@lists.php.net to get a copy of this message | ||
Note Submitter:
----
Actually, w.hartley@qut.edu.au was CLOSE - the ora_fetch() issued early on doesn't allow the
data to be displayed on the page. This do loop would work a little better...
<%<BR>
putenv("ORACLE_SID=D704");<BR>
putenv("ORACLE_HOME=C:\ORANT");<BR>
$conn = ora_plogon("test", "test");<BR>
$curs = ora_open($conn);<BR>
ora_commitoff($conn);<BR>
$query = "select code,descr,to_char(sysdate,'DD-MON-YYYY HH24:MI:SS')
sysdate_x from simplicities";<BR>
/* Long version */<BR>
ora_parse($curs, $query);<BR>
ora_exec($curs);<BR>
ora_fetch($curs);<BR>
<BR>
$ncols = ora_numcols($curs);<BR>
$nrows = ora_numrows($curs);<BR>
printf("Result size is $ncols cols by $nrows rows.<br>");<BR>
for ($i=0; $i<$ncols; $i++) {<BR>
printf("col[%s] = %s type[%d] = %s<br>",<BR>
$i, ora_columnname($curs, $i),<BR>
$i, ora_columntype($curs, $i));<BR>
}<BR>
%><BR>
<%<BR>
/* remember, we already fetched the first row to get column metrics */<BR>
do {<BR>
for ($i=0; $i<$ncols; $i++) {<BR>
printf("%s = %s", ora_columnname($curs,$i), ora_getcolumn($curs,$ i));<BR>
printf("<br>");<BR>
}<BR>
printf("<br>");<BR>
} while (ora_fetch($curs)) ;<BR>
%><BR>