note 1984 modified in Oracle functions by ronabop

From: Date: Tue, 08 Aug 2000 19:54:25 +0000
Subject: note 1984 modified in Oracle functions by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-685@lists.php.net to get a copy of this message
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> http://www.php.net/manual/oracle-functions.php

« previous php.notes (#685) next »