This topic is locked

&$values with AfterAdd and AfterDelete

9/24/2006 3:54:00 PM
PHPRunner General questions
D
defcon2000 author

Hello,
We are trying to use data from the xxx_add.php within the xxx_events.php. I have noticed in many posts as well as on the PHPR site "&$values", however when I use this like "function AfterAdd(&$values)", I get the following error message:
Technical information

Error type 2

Error description Missing argument 1 for AfterAdd(), called in D:\Program Files\xampp\htdocs\techdialup_add.php on line 130 and defined

URL 192.168.0.2/techdialup_add.php?

Error file D:\Program Files\xampp\htdocs\include\techdialup_events.php

Error line 2

SQL query insert into `techdialup` (`customer_id`, `subscription_id`, `dialupusername`, `dialuppassword`, `comments`) values (1, 429, 'bingo', 'wingo', 'No Comments')
All I am simply trying to do is to extract the values of "dialupusername" and "dialuppassword".
Can someone tell me why?
Rgds,

J
Jane 9/25/2006

Hi,
there is no $values variable in the AfterAdd or AfterDelete event.

I recommend you to use BeforeAdd or BeforeDelete events.

Here is a sample code:

function BeforeAdd(&$values)

{

echo $values["dialupusername"];

return true;
}


function BeforeDelete($where)

{

global $conn;

$str = "select dialupusername from TableName where ".$where;

$rs = db_query($str,$conn);

$data = db_fetch_array($rs);

echo $data["dialupusername"];

return true;

}