This discussion is archived
2 Replies Latest reply: Oct 14, 2012 2:20 AM by EJP RSS

PHP,oracle and java

967161 Newbie
Currently Being Moderated
i am creating a table in PHP where there are 3 datas extracting from oracle command.
the first 2 will act as row and column(distinct)
and 3 will be the data for those row and column.
i cannot figure out how to make comparison for row and column and then insert the 3rd data for the cell.
here is my whole code
echo "<table border=1 >";

$q = "select s.season_name, sl.length_desc,sum(hf.f_swaps)as failed_swaps from holiday_fact
hf,season s,swap_length sl where hf.s_length=sl.s_length and hf.season_id
=s.season_id group by cube (s.season_name,sl.length_desc)";

echo "<th> Season </th>";

$column="select distinct length_desc from ($q)";
$cur2=OCIParse($c,$column);
if(OCIExecute($cur2))
   for($j=0;$j<9;$j++)
{
   if(OCIFetch($cur2))
   {
      $col_rows=OCIResult($cur2,1);
   }
   else
   {
      $col_rows=" ";
   }
   echo "<th> $col_rows </th>";
}

$row="select distinct season_name from($q)";
$cur = OCIParse($c,$row);
if (OCIExecute($cur))
   for($i=0;$i<9;$i++)
   {
if(OCIFetch($cur))
{
   $num_rows=OCIResult($cur,1);
}
else
{
   $num_rows=" ";
}

echo "<tr><td> $num_rows </td></tr>";
}

$summary="select failed_swaps from($q)";
$cur3=OCIParse($c,$summary);
if(OCIExecute($cur3))
   for($k=0;$k<9;$k++)

{
   if(OCIFetch($cur3))
   {
   $summary_rows=OCIResult($cur3,1);
   }
   else
   {
   $summary_rows=" ";
   }
   echo "<td> $summary_rows </td>";
   }


echo "</table>";

?>

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points