CodeIgniter Laravel PHP Oracle PHP Example Javascript jQuery MORE

Delete record or Data using Oracle and PHP


In this example we use 3 file for Delete record or Data using Oracle and PHP.

  1. view.php
  2. database.php
  3. delete_process.php

view.php

			
<!DOCTYPE html>
<html>
<head>
	<title>Delete employee data</title>
</head>
<body>
<table>
	<tr>
		<td>First Name</td>
		<td>Last Name</td>
		<td>City</td>
		<td>Email id</td>
		<td>Action</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>
		<td><a href="delete_	process.php?userid=<?php echo $row["userid"]; ?>">Delete</a></td>
	</tr>
	<?php
	$i++;
	}
	?>
</table>
</body>
</html>			

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);
}
?>

delete_process.php

<?php
	include_once 'database.php';
	$query = oci_parse($conn, "DELETE FROM employee WHERE userid='" . $_GET["userid"] . "'");
	$result = oci_execute($query, OCI_DEFAULT);  
	if($result)  
	{  
		oci_commit($conn); //*** Commit Transaction ***// 
		echo "Data Deleted Successfully.";
	}
	else{
		echo "Error.";
	}
?>