Hi,
I have some php code activated via events that in need to use in 7 places in a project. I'm trying to put the code in a function in the loginonload event and just can't seem to get it working....
Here's what apears in the loginonload event...
function LoginOnLoad(&$params)
{
// Put LoginOnLoad code here.
}
//**** Insert project specific functions here ****
function recalcoverallquoteprice()
{
global $conn;
$strSQL = "select sum(`Final exc Seals SWT Init`) as FullQuoteInitBase from facilities where ServiceID=".$_SESSION["ServiceID"];
$rs = db_query($strSQL,$conn);
$data=db_fetch_array($rs);
$strSQLUpdate = "Update services set `Full Quote Init Base`=".$data["FullQuoteInitBase"]." where ServiceID=".$_SESSION["ServiceID"];
db_exec($strSQLUpdate,$conn);
} // function LoginOnLoad
I'm calling this via an edit page after record updated event using as follows:
recalcoverallquoteprice()
The code works fine if I just insert it into the after record updated event (without the function line) so I know the code does the job. But if I try to use the function then I get a "syntax error, unexpected {"** as soon as I try to bring up the edit page.
What am I doing wrong here? <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=6626&image=1&table=forumtopics' class='bbc_emoticon' alt=':blink:' />