0

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

Edited by kannasekar

2
Contributors
2
Replies
10
Views
2 Years
Discussion Span
Last Post by kannasekar
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.