I am using php / mysql and protype.js to delete record from a table. The problem is that the record in the database is not deleted.
index.php:
<a href="javascript: deleteId('<?php echo $studentVo->id?>')">Delete</a></td>
Script is
function deleteId(id)
{
alert("ID : "+id);
new Ajax.Request('delete.php?action=Delete&id='+id,{method:'post'});
$(id).remove(); // because <tr id='".$row[id]."'> :)
}
delete.php
<?php
/* Database connection */
include('configuration.php');
echo "hello,...";
if(isset($_POST['id'])){
$ID = $_POST['id'];
$sql = 'DELETE FROM student where id="'.$ID.'"';
mysql_query($sql);
}
else { echo '0'; }
?>
alert("ID : "+id);
is working properly but the code after that is not.