my problem is basically that the trigger (MySQL) is not fired after an INSERT data from a PHP function and I don't know why. The trigger fires normally when I insert data from MySQL Workbench.
Here is an example code for better understanding:
PHP function:
public function insert($data){
$result = mysql_query("INSERT INTO Table(Column) VALUES('$data')");
if($result){
return true;
}
return false;
}
Trigger:
delimiter //
CREATE TRIGGER last_id AFTER INSERT ON Table
FOR EACH ROW
BEGIN
SET @lastid = NEW.Id;
END;//
And finally when I execute this query from MySQL Workbench for example:
INSERT INTO Table(Column) VALUES(1)
the trigger fires normally.
NOTE: the PHP function also inserts the data successfully, the only problem is that it doesn't fire the trigger.