CodeIgniter Laravel PHP Oracle PHP Example Javascript jQuery MORE

Fetch record or Data using Oracle and PHP


In this example we use 2 file for Fetch record or Data using Oracle and PHP.

  1. database.php
  2. view.php

database.php

<?php
$conn=oci_connect("COMMON","ADMIN","172.16.16.20/WETDB");
if (!$conn) {
	$e = oci_error();
	trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
?>

view.php

<!DOCTYPE html>
<html>
 <head>
 <title> Retrive data</title>
 </head>
<body>
<table>
	<tr>
		<td>First Name</td>
		<td>Last Name</td>
		<td>City</td>
		<td>Email id</td>
	</tr>
<?php
$i=0;
while($row=oci_fetch_array($result)) {
?>
	<tr>
		<td><?php echo $row["first_name"]; ?></td>
		<td><?php echo $row["last_name"]; ?></td>
		<td><?php echo $row["city_name"]; ?></td>
		<td><?php echo $row["email"]; ?></td>
	</tr>
<?php
$i++;
}
?>
</table>
</body>
</html>