This should be a guide for Oracle data manipulation from PHP.

First of all, the connection:

<?php $ora_conn = ora_logon("username@instance","password"); ?>

the sql string (we’ll use select in this example):

<?php $sql = "select col1, col2, col3 from table1 where 1=1"; ?>

the loop that retrieves the data and publish as a HTML table:

$ora_cur = ora_do($ora_conn, $sql);
if ($ora_cur)
        $numCols = ora_numcols($ora_cur);
        //alternative coloring
        $col1 = "#eeeeee";
        $col2 = "#dddddd";
        $toggle = "#eeeeee";
        do {
               $toggle == $col1? $toggle = $col2: $toggle = $col1;
        <tr bgcolor="<? echo $toggle;?>">
          <td class="normal"><? echo ora_getcolumn($ora_cur,0);?></td>
          <td class="normal"><? echo ora_getcolumn($ora_cur,1);?></td>
          <td class="normal"><? echo ora_getcolumn($ora_cur,2);?></td>
          <td class="normal"><? echo ora_getcolumn($ora_cur,3);?></td>
        } while (ora_fetch($ora_cur));


Leave a Reply