Trying to build dynamic table from Oracle query

Hi,
I am trying to build a dynamic HTML table from the results of an Oracle Query.  I have done this with MySQL, but the Oracle calls are much different (especially for a newbie).
My code is below...I think it's close, but still somewhat bungled up.  Can anyone please get this work?  There are 9 rows being returned from the query.
Thx,
Andy
<?php
   $conn = OCILogon('abcd', 'abcd', '//bsiaix6.abcd.com:1521/ABCD.bsiaix6') or die("ERROR CONNECTING - Notify Global Support");
   $query = "select literal_text from ci.literal where literal_group = 'Impacted Factors' order by seq_no";
   $stid = OCI_Parse($conn, $query);
   $r = OCI_Execute($stid, OCI_DEFAULT);
   if ($r)
   {
      echo "<table border=0>";
      oci_fetch_all($stid,$x);
      for ($i = 0; $i < oci_num_rows($stid); $i++) 
      {
         echo "<TR bordercolor=#ffff99>";
         $row = OCI_FETCH_ARRAY ($stid, OCI_ASSOC);
         while ($row = OCI_FETCH_ARRAY ($stid, OCI_ASSOC))
         {
            foreach ($row as $item)
            {
               echo "<TD width=858>" . "<font color=#990099>".  
               "<input type='checkbox' value = '$item' name = 'factors[]'>" . $item . 
               "</font>"."</td>";
            }  // End of FOREACH
         }  // End of While
      }  // End of FOR
     echo "</tr>";
     echo "</table>";
   }
   else
   {
      echo 'Unable to execute query.  Notify Global Support.';
   }  // end of IF
OCILogoff($conn);
?>

Open in new window

LVL 2
abruskoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hernst42Commented:
Try this code

Your are reading the result set to often in your script, which prevents the output of anything.
<?php
$conn = OCILogon('abcd', 'abcd', '//bsiaix6.abcd.com:1521/ABCD.bsiaix6') or die("ERROR CONNECTING - Notify Global Support");
$query = "select literal_text from ci.literal where literal_group = 'Impacted Factors' order by seq_no";
$stid = OCI_Parse($conn, $query);
$r = OCI_Execute($stid, OCI_DEFAULT);
if ($r)
{
    echo "<table border=0>";
    while ($row = OCI_FETCH_ARRAY ($stid, OCI_ASSOC))
    {
        echo "<TR bordercolor=#ffff99>";
        foreach ($row as $item)
        {
            echo "<TD width=858>" . "<font color=#990099>".
            "<input type='checkbox' value = '$item' name = 'factors[]'>" . $item .
            "</font>"."</td>";
        }  // End of FOREACH
        echo "</tr>";
    }  // End of While
    echo "</table>";
} else {
    echo 'Unable to execute query.  Notify Global Support.';
}  // end of IF
OCILogoff($conn);
?>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
abruskoAuthor Commented:
Leaving for the day...will try 1st thing in the a.m...thank you!
0
abruskoAuthor Commented:
Byoootiful...works perfectly...thank you very much!!!

Andy
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.