I run the app and when I add a new record I get this error -
Query:
INSERT INTO `Actions`(`P_Record_ID`, `Name`, `Description`, `Location`, `Context`, `Due_Date`, `Source_Table`, S_Record_ID)
SELECT `P_Record_ID`, `Name`, `Description`, `Location`, `Context`, `Due_Date`, 'Tools_Needed', ''
FROM `Tools_Needed` t
WHERE t.ID =
Notice that right after 'Tools_Needed' the field is null also after' WHERE t.ID ='. That's supposed to be the PK. I looked in the database with PHP Admin and the record doesn't exist. I use the identical code for 'after update' and it works. Of course, the record is in the database anyway using UPDATE.
To me it looks like it's not inserting the record before calling the function 'after insert'.
Any thoughts?
Or is my code wrong?
Code: Select all
function Tools_Needed_after_insert($data, $memberInfo, &$args) {
$myID = $data['selectedID];
$S_Record_ID = $myID;
$Tn = "Tools_Needed";
If ($data['Context'] != "") {sql("INSERT INTO `Actions`(`P_Record_ID`, `Name`, `Description`, `Location`, `Context`, `Due_Date`, `Source_Table`, S_Record_ID)
SELECT `P_Record_ID`, `Name`, `Description`, `Location`, `Context`, `Due_Date`, '$Tn', '$myID'
FROM `Tools_Needed` t
WHERE t.ID = $myID", $eo);
}
return TRUE;