<html>
<head>
<meta charset="utf-8" />
<title>jQuery_PHP_Qracle Query Editor</title>
<style type="text/css">
html, body { height: 100%; }
.TB2 { border:2px solid navy; color:green; }
.TB1 { border:2px solid green;color: navy;
vertical-align:text-top;width:300px; height:100px;}
.sp1 { width: 450px; height:100px; overflow:auto;color:navy;}
.td1 { width: 60px; height: 10px;background-color:#b0c4de;}
.td2 { width: 60px; height: 20px; font-size:12px;}
.td3 { width: 50px; height: 20px;} </style>
<script src="http://frontiersoft.net/jquery-latest.js"></script>
<script type="text/javascript" src="http://manas9/jQuery/jquery-latest.js"></script>
<script>
//Code Starts
$(document).ready(function() {
var doc2 = document.getElementById("div3");
$.ajaxSetup({ cache:false});
$("a.RR").click(function (){ location.reload();
$('input[type=textarea]').each(function() {
$(this).val('');
});

}); // reload the page
});
</script>
</head>
<body>
<!-- http://manas8x/BareBone_PHP/test_scott_post4.php -->
<!-- http://manas8x/BareBone_PHP/Oracle_SQLQuery_Tool.php -->
description: http://manas8x/BareBone_PHP/Oracle_SQLQuery_Tool.php <br/>
On Line Oracle SQL-Query-with-PHP ||<br/> IIS in windows 7 ultimate workstation
connecting as<br/> $conn = oci_connect('scott', 'Son', 'localhost/orcl.gateway.2wire.net');
<br/><a class="RR" href="#">re-load()</a>||
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<textarea name="sql" class="TB1" >SELECT * FROM emp</textarea><br>
<input type="submit" name="submit" value="Submit Form"><br>
</form>
<?php
$sql = "";
if(isset($_POST['submit']))
{
$sql = $_POST['sql'];
echo "Oracle sql-query <br/><span class='sp1'> : $sql </span>";

$conn = oci_connect('scott', 'Son', 'localhost/orcl.gateway.2wire.net');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
echo" DB connected: querying a table <br/>";
}
$stmt = oci_parse($conn, $sql);
oci_execute($stmt);

echo "<table border=\"1\">";
echo "<tr>";

$ncols = oci_num_fields($stmt);

for ($i = 1; $i <= $ncols; $i++) {
$column_name = oci_field_name($stmt, $i);
echo "<td class='td1'>$column_name</td>";
}
//
echo "</tr></table>\n";
//
echo "<table border='1'>\n";
while($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) {
echo "<tr>\n";
foreach ($row as $item) {
echo "<td class='td2'>".($item !== null ? htmlentities($item, ENT_QUOTES):"&nbsp;")."</td>\n";
} //foreach ends
echo "</tr>\n";
}//while block ends
echo "</table>\n";
//

oci_free_statement($stmt);
oci_close($conn);
//
}
?>
</body>
</html>