Watch Our YouTube Channel
It is currently Sat Dec 16, 2017 5:18 am
 

All times are UTC



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Sat Dec 21, 2013 10:22 am 
Offline

Joined: Tue Jan 29, 2013 10:24 am
Posts: 145
Location: India
The below code is used to delete a particular record from Database.

Code:
<script language="javascript">
function delete_confirm(userid)
{
   var delte_status=confirm('Are you sure want to delete this Footprint?');
   if (delte_status)
   {
       window.location.href='delete_records.php?id='+userid;
   }
   return delte_status;
}
</script>



<a href="#" onClick="javascript: return delete_confirm('<?php echo $id;?>');"><img src="images/delete.jpg" border="0" title="Delete user"></a>


delete_records.php
Code:
<?php
$id=trim($_GET['id']);
$query="DELETE FROM  tablename WHERE id=".$id;
if(!mysql_query($query))
{
   die('Error, Delete Query Failed. Not able to delete from tablename');
}
else
{
   $targetPage="list.php?status=Record Deleted Successfully";
   redirect($targetPage);
}
?>

_________________
K.Suresh Kumar
Motivational Quotes | Web Development | Software Testing


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron