<?php
$servername= "localhost";
$username="root";
$password="";
$database="mnexam";
$con = mysqli_connect($servername,$username,$password,$database);
if(!$con)
{
die("connection failed : " .mysqli_connect_error());
}
?>
<!DOCTYPE html>
<html>
<head>
<title>insert</title>
</head>
<body>
<div class="row text-center">
<div class="container">
<h1>Insert DATA</h1>
<form action="index.php" method="post">
<input type="text" name="firstname" placeholder="firstname"><br><br>
<input type="text" name="lastname" placeholder="lastname"><br><br>
<input type="email" name="email" placeholder="email"><br><br>
<input type="text" name="number" placeholder="number"><br><br>
<input type="text" name="address" placeholder="address"><br><br>
<input type="submit" name="submit" value="insert"><br><br>
</form>
<button><a href="show.php">Show data</a></button>
</div>
</div>
</body>
</html>
<?php
error_reporting(0);
include 'connection.php';
if (isset($_POST['submit'])) {
$id= $_POST['id'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$number = $_POST['number'];
$address = $_POST['address'];
$sql = "INSERT INTO mnexam (firstname, lastname, number, address,email) VALUES ('$firstname', '$lastname', '$number', '$address', '$email')";
$data=mysqli_query($con,$sql);
if($data)
{
echo "record inserted...";
}
else
{
echo "Error: Something Wrong....";
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>show table</title>
<style>
th, td
{ padding: 15px; }
</style>
</head>
<body>
<?php
include ('connection.php');
$sql ="select * from mnexam";
$data =mysqli_query($con,$sql);
$total=mysqli_num_rows($data);
if ($total=mysqli_num_rows($data))
{
echo "<table border='2'>";
echo "<tr>";
echo "<th>Id</th>";
echo "<th>Firstname</th>";
echo "<th>Lastname</th>";
echo "<th>Email</th>";
echo "<th>Number</th>";
echo "<th>Address</th>";
echo "<th>Delete</th>";
echo "<th>Update</th>";
echo "</tr>";
}
else
{
echo "No record found....";
}
?>
</table>
<a href="index.php">HOME</a>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>update</title>
</head>
<body>
<form action="" method="get">
<input type="text" name="id" placeholder="id" value="<?php echo $_GET['id']; ?>"><br><br>
<input type="text" name="firstname" placeholder="firstname" value="<?php echo $_GET['firstname']; ?>"><br><br>
<input type="text" name="lastname" placeholder="lastname" value="<?php echo $_GET['lastname']; ?>" ><br><br>
<input type="email" name="email" placeholder="email" value="<?php echo $_GET['email']; ?>"><br><br>
<input type="text" name="number" placeholder="number" value="<?php echo $_GET['number']; ?>"><br><br>
<input type="text" name="address" placeholder="address" value="<?php echo $_GET['address']; ?>"><br><br>
<input type="submit" name="submit" value="update">
</form>
<?php
error_reporting(0);
include ('connection.php');
if ($_GET['submit'])
{
$id = $_GET['id'];
$firstname = $_GET['firstname'];
$lastname = $_GET['lastname'];
$email = $_GET['email'];
$number = $_GET['number'];
$address = $_GET['address'];
$sql="UPDATE mnexam SET firstname='$firstname' , lastname='$lastname', email='$email' , number='$number', address='$address' WHERE id='$id'";
$data=mysqli_query($con, $sql);
if ($data)
{
//echo "record update";
header('location:show.php');
}
else{
echo "ERROR:SOMTHING WRONG FOR UPDATE RECORD....";
}
}
else
{
echo "<H2>Click on button to UPDATE the change</H2>";
}
?>
</body>
</html>
<?php
include ('connection.php');
$id = $_GET['id'];
$sql ="DELETE FROM mnexam WHERE id='$id'";
$data = mysqli_query($con,$sql);
if ($data)
{
echo "Record deleted.....";
header('location:show.php');
}
else
{
echo "error";
}
?>
Imports System.Data.OleDb
Partial Class Default2
Inherits System.Web.UI.Page
Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\aspn.mdb")
End Class