Deleting Issues
Posted: Wed Aug 17, 2011 10:50 pm
I could successfully delete a record in the database but if i type anything not in d database it will still perform the content inside the echo paragraph. Below is the code i used.
Please kindly sort out any correction.
Thanks
Code: Select all
<?php
if(isset($_POST['Delete']))
{
$sql="Delete from student_details where Username='".$_POST['Username']."'";
$result = mysql_query($sql);
if($result){
echo '<p class=delstudent>';
echo "You have Deleted Successfully";
echo '</p>';
header("refresh:2;URL=admindel.php");
}
}
else
{
echo mysql_error();
}
?>Thanks