This topic is locked

events

7/25/2006 5:25:10 PM
PHPRunner General questions
adamdidthis author

Hi i have added the foloowing event:

<?

function AfterEdit(&$values)

{

//********** Insert a record into another table ************
global $conn;

$ip = $_SERVER["REMOTE_ADDR"];

$name = @$_SESSION["UserID"];

$ordnum = $values["ordnum"];

$strSQLInsert = "insert into editlog (name,ordnum,time) values ('$name', '$ordnum', NOW())";

mysql_query($strSQLInsert,$conn);
}
?>


but i get the following error:
2

Error description Missing argument 1 for AfterEdit(), called in C:\Inetpub\wwwroot\newintranet\departments\Finance\Database\finance\orderform_edit.php on line 981 and defined

URL intranet/departments/finance/database/finance/orderform_edit.php

Error file C:\Inetpub\wwwroot\newintranet\departments\Finance\Database\finance\include\orderform_events.php

Error line 2

SQL query update `orderform` set `ordnum`=100002, `orddate`='2006-05-24 00:00:00', `refnum`='diana.holmes@gm.tv', `supname`='Excellent Voice over company', `deliverto`='GMTV', `chartgeto`='Promotions', `quant1`='1', `descript1`='voice over for promos', `quant2`='0', `descript2`='', `quant3`='0', `descript3`='', `quant4`='0', `descript4`='', `quant5`='0', `descript5`='', `quant6`='0', `descript6`='', `quant7`='0', `descript7`='', `quant8`='0', `descript8`='', `quant9`='0', `descript9`='', `quant10`='0', `descript10`='', `delivery`='1.00', `auth`=' Di Holmes', `delivdate`='2006-05-24 00:00:00', `authdate`='2006-05-24 00:00:00', `unit1`='150.00', `unit2`='0.00', `unit3`='0.00', `unit4`='0.00', `unit5`='0.00', `unit6`='0.00', `unit7`='0.00', `unit8`='0.00', `unit9`='0.00', `unit10`='0.00', `glcode`='65090', `costcen`='PR2', `findept`='OPS', `jobcode`='', `jobanal`='', `notes`='voice over', `manager`='Holmesd', `vatfree`=NULL, `secondauth`='', `glcode2`='', `glcode3`='', `glcode4`='', `glcode5`='', `glcode6`='', `glcode7`='
any ideas?

J
Jane 7/26/2006

Adam,
there is no $values variable in the AfterEdit event.

Use BeforeEdit event for your purpose:

function BeforeEdit(&$values, $where)

{

//********** Insert a record into another table ************
global $conn;

$ip = $_SERVER["REMOTE_ADDR"];

$name = @$_SESSION["UserID"];

$ordnum = $values["ordnum"];

$strSQLInsert = "insert into editlog (name,ordnum,time) values ('".$name."', ".$ordnum.", NOW())";

mysql_query($strSQLInsert,$conn);

return true;

}
adamdidthis author 7/26/2006

Thats spot on thanks

A
amirgulamali 7/28/2006

hey,
I am trying to do something similar but I cant get it work;
pls follow this link

http://www.asprunner.com/forums/index.php?showtopic=3080
thanks