Hi,
I am using a small php script to return records from an oracle8.1.6
database. I would like to have one of the columns contents display the data
as a hyperlink and I am not quite sure how to do it. Here is the code that
returns the data (which is correct). The table formatting is the issue. All
help is greatly appreciated.
--cbf
/ create connection
if ($connection = OCIPLogon("chowder","head","help"))
{
//echo "$connection ".OCIServerVersion($connection)."<BR>\n";
}
else
{
echo "Couldn't connect to Oracle.<BR>\n";
Exit();
}
// create SQL statement
$sql = "select
case_id,
case_desc,
evnt_code||' - '||evnt_desc,
sched_date||' - '||start_time
// parse SQL statement
$sql_statement = OCIParse($connection,$sql)
or die("Couldn't parse statement.");
// execute SQL query
OCIExecute($sql_statement)
or die("Couldn't execute statement.");
echo OCIError()."<BR>";
// get number of columns for use later
// start results formatting
$row1 = "#EEEEF8";
$row2 = "#ffffff";
$rowcolor = $row1;
echo "<TABLE BORDER=0>";
echo "<TR>
<TH>Case Number</TH>
<TH>Case Description</TH>
<TH>Event Code & Description</TH>
<TH>Scheduled Date & Time</TH>
</TR>
";
// format results by row
while (OCIFetch($sql_statement)) {
echo "<TR BGCOLOR='$rowcolor'>";
$num_columns = OCINumCols($sql_statement);
for ($i = 1; $i <= $num_columns; $i++) {
$column_name = OCIColumnName($sql_statement,$i);
$column_value = OCIResult($sql_statement,$i);
echo "<TD>$column_value</TD>";
}
echo "</TR>";
if ($rowcolor == $row1) $rowcolor = $row2;
elseif ($rowcolor == $row2) $rowcolor = $row1;
}
echo OCIRowcount($sql_statement) . " records returned";
echo "</TABLE>";
// free resources and close connection
OCIFreeStatement($sql_statement);
OCILogoff($connection);
?></p>
Thanks.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php