I've a PHP script to fetch the data from Oracle SQL. I need to include fetch statement in HTML code. Basically I want to process all PHP related and database related queries in PHP tag and wherever required, i can fetch the result from the array rather again include oci_fetch() and oci_result statements.
e..g,
<?php
/* Database Connection*/
if(!$dbConn = oci_connect('WHSUSR','goldeneyex','MyServer.biz:1530/OSLTP')){
$err = oci_error();
trigger_error('Could not establish a connection: ' . $err['message'], E_USER_ERROR);
};
/* Query to get Users last accessed appication */
$strSQLUserLogInDetails = "select v.user_name, max(start_time) from sessiont s inner join V_BO_USER_CODES v on v.user_obj_id = s.user_id
where v.user_name not in ('KALIDO MDM Anonymous User', 'KALIDO MDM Publication Service User')
group by v.user_name
order by 2 desc";
$stmtUserLogInDetails = oci_parse($dbConn,$strSQLUserLogInDetails);
if ( ! oci_execute($stmtUserLogInDetails) ){
$err = oci_error($stmtUserLogInDetails);
trigger_error('Query failed: ' . $err['message'], E_USER_ERROR);
};
?>
and HTML code below...
<table class="table table-striped" title="List of Users who last accessed Kalido application">
<thead><tr><th>User Name</th><th>Last Accessed On</th></tr></thead>
<tbody>
<?php
while(oci_fetch($stmtUserLogInDetails)){
$uname = oci_result($stmtUserLogInDetails, 1);
$datetime = oci_result($stmtUserLogInDetails, 2);
print "<tr><td><a href='userlevelreport.php?uname=".$uname."'>" .$uname. "</a></td><td>".$datetime."</td></tr>";
}
?>
</tbody>
</table>
{}button