Tutorials Home Scripts Home
file name: Jooria_Delete/index.php
Size: 944 B
date: 3 months ago

Jooria_Delete/index.php Contents

Jooria_Delete/index.php

This file is located in Jooria_Delete.zip

<?php

/**
 * @author www.jooria.com
 * @file db.php
 * @link
http://www.jooria.com/Tutorials/Website-Programming-16/Delete-Records-With-Effect-Using-jQuery-And-P
HP-152/index.html
 */
?>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"
type="text/javascript"></script>
<script src="Jooria_Delete_0.2.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
    $('.delete').Jooria_Delete('id','Sure you want to delete this one?');
});
</script>



</head>
<?php
include ('db.php');

if(isset($_POST['id'])){
mysql_query("delete from users where id='".intval($_POST['id'])."'");
exit;
}

$sql = mysql_query("select * from users order by id asc");

echo "<ul>";

while($Row = mysql_fetch_array($sql)){
extract($Row);   
echo "<li>$name [<a id='$id' style='color:#ff0000;' class='delete'
href='#'>Delete</a>]</li>\n";   
}

echo "</ul>";

?>