Hello everybody,
I searched for this in the forum but didn't find anything, pls refer me to the link if it has already been answered.
I want to add JobId into commissions table after a new job has been added. But as The JobId will only be created after the record has been added therefore I cannot add JobId which is required later for my update querry. I have tried after record added but somehow is not working, here is the code:
/*****
global $conn;
$CId=$values["CId"];
$QuotedPrice=$values["QuotedPrice"];
$Date=$values["Date"];
$JId=$values["JId"];
$sqlSelect = "select ParentId from customers where CId=$CId";
$rsCustomer = db_query($sqlSelect,$conn);
$data=db_fetch_array($rsCustomer);
$Parent=$data["ParentId"];
$sqlSelectGParent = "select ParentId from customers where CId=$Parent";
$rsGParent = db_query($sqlSelectGParent,$conn);
$dataGParent=db_fetch_array($rsGParent);
$GParent=$dataGParent["ParentId"];
$strSQLInsert = "insert into Commissions(JId, Customer,Parent,GrandParent,Price,Date)values($JId,$CId,$Parent,$GParent,$QuotedPrice,$Date)";
db_exec($strSQLInsert,$conn);
}
return true;
*/