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.

$mode = $_REQUEST["mode"];
echo $mode;
        if ( $mode == "delete" ) {
        echo $id;

        $update=mysql_query("update newsletter set status = '2' where id = ".$id);                   //$update=mysql_query("update newsletter set status = '2' where id = '$id' ");     

          $msg="Successfully Deleted!!";
          echo "<script type='text/javascript'>alert('$msg');</script>";
        $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

Recommended Answers

All 2 Replies

Where is the connection to the database?

Thank You So Much pritaeas

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.