Hi Everyone, I am a newbie to PHP programming. I just need to update the status when user click delete button. Here is the piece of code that I tried. When I echo the values of $mode and $id it prints properly. But the update query block doesn't working.
<?php
$mode = $_REQUEST["mode"];
echo $mode;
if ( $mode == "delete" ) {
$id=$_GET["id"];
echo $id;
$update=mysql_query("update newsletter set status = '2' where id = ".$id); //$update=mysql_query("update newsletter set status = '2' where id = '$id' ");
if($update)
{
$msg="Successfully Deleted!!";
echo "<script type='text/javascript'>alert('$msg');</script>";
header('Location:newsletter.php');
}
else
{
$errormsg="Something went wrong, Try again";
echo "<script type='text/javascript'>alert('$errormsg');</script>";
}
}
?>
I've tried commented update statement also no change.Please anyone give me some help. Thanks in advance