HTML/Javascript

SES by business degree online promotion team.

Philippine Airlines International Flight schedules

Philippine Airlines International Flight schedules
Philippine Airlines International Flight schedules

Search This Blog

Wednesday, October 6, 2010

PHP Delete Record Entry script

Sample delete record php script

<?php
$con = mysql_connect("localhost","root","yourpassword");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("hotelreservation", $con);


$hotelid=$_POST['hotelid'];
$accountpassword=$_POST['accountpassword'];

$resultx = mysql_query("SELECT * FROM location where locationpassword='$accountpassword'");
$count=mysql_num_rows($resultx);
if($count==1)
{
mysql_query("delete from room where hotelid='$hotelid'");
echo "record deleted";
}
else
{
echo"<br><br><br><br><br><br>";
echo "<p align='center'><b>Your id is invalid.</b></p>";
}

mysql_close($con)
?>

or you can use this one to delete record

delete.php

<?php
$con = mysql_connect("localhost","root","yourpassword");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("hotelreservation", $con);

// Get value first from form.
$id=$_GET['id'];

// create for delete statement
mysql_query("delete from name where id='$id'");

// Close the datebase connection
mysql_close();

// Redirect to recordelet_info.php
header("location:recordelete_info.php");


mysql_close($con)
?>

recordelete_info.php
<?php
echo "record deleted";
?>


or
delete.php this one to delete record

<?php
Note: This will delete all the records that have number id=3
mysql_query("delete from personelinfo where idno like '3'");
echo"<br><br><br><br><br><br>";
echo "<p align='center'><b>Record deleted.</b></p>";
?>

No comments:

Post a Comment