0 Replies Latest reply on Jan 26, 2010 10:10 AM by montego

    Custom Trigger after Delete not  executing

    montego

      I have a custom trigger that I want to execute after a user performs a DELETE Transaction. Here is the PHP code:

       

      $DB_SERVER = "somewhere.com";

      // username:
      $DB_USER = "me";

      // password:
      $DB_PASS = "password";

      // database name:
      $DB_NAME = "training";

      $sessid=$_GET['sessid'];
      $userid=$_GET['id'];


      mysql_connect($DB_SERVER, $DB_USER, $DB_PASS);
          mysql_select_db($DB_NAME);


      $sql = "DELETE FROM tms_registered where eid ='$sessid' AND uid = '$userid'";
      $sql2 = "SELECT COUNT(*) AS max FROM tms_registered WHERE eid ='$sessid'";
      $result = mysql_query( $sql2 )
              or die ( 'Unable to execute query.' );
      $max_value = mysql_result($result, $i, "max");
      $sql3 = "UPDATE tms SET cur_reg='$max_value' WHERE tmid='$sessid'";

       

      I have also written the trigger by declaring the variables at the top of the PHP script page and then use 'global': at the begining of the trigger:

       

      global $DB_SERVER, $DB_USER, $DB_PASS, $DB_NAME, $sessid, $userid;

       

      The trigger does not execute after the DELETE transaction. What am I doing wrong?

       

      TIA