This topic is locked

Fetching autoincrement id to e-mail after ADD

12/5/2007 6:32:47 AM
PHPRunner General questions
scuba author

Hi erveryone,
I'm trying to track changes by e-mail. So for Event Edit-Page I've built this code:
// ** Send data per email ****

global $conn,$strTableName;

$email = "webmaster@ges-electronic.de";
// modify the following SQL query to select fields you like to send

$rs = db_query("select comp_name, id from " . $strTableName ." where ". $where,$conn);
if($data=db_fetch_array($rs))

{

foreach($data as $field=>$value)

$message = $field.": ".$value."\r\n

New status: ".$values["act_inq_status"]."\n

Editor: ".$values["inq_forward"]."\n";

$subject = $value."\r\n";

mail($email, $subject, $message);

}

return true;
works good. Problem is, I would also like to track Added records including the autoincrement-ID they get assigned form the MySQL-DB. But how can I query an ID for a record that actually hasn't been added to the DB yet?? It doesn't seem to work by using After Record Added.
thanks in advance

Sergey Kornilov admin 12/5/2007

Use $keys["id"] in AfterAdd event.

scuba author 12/6/2007

thanks Serg, but I still can't get that to work. Here is how I've used your suggestion - am I using it the right way?
// ** Send data per email ****

$email = "webmaster@ges-electronic.de";

$message =

"\n**** ADD ***\n

An inquiry has been added to the GES Data-Warehouse.\n

**\n

ID: ".."\n

Company: ".$values["comp_name"]."\n

Status: ".$values["act_inq_status"]."\n

Editor: ".$values["inq_forward"]."\n

------------------------------------------------------\n

Contact: ".$values["con_mr_mrs"]." ".$values["con_first_name"]." ".$values["con_last_name"]."\n

Country: ".$values["compadr_country"]."\n

Product / Units: ".$values["inqdet_series_1"]." / ".$values["inqdet_units_1"];

$subject = [color=#FF0000]$keys["id"];

mail($email, $subject, $message);

return true;

J
Jane 12/7/2007

Hi,
make sure that id is your actual field name where ID value is stored.

scuba author 12/7/2007

Hmm, yes it actually is?! <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=23971&image=1&table=forumreplies' class='bbc_emoticon' alt=':huh:' /> still no id fetch. Could it be that the ISP is blocking that somehow?
thanks anyway!

Alexey admin 12/7/2007

Hi,
you can publish your project on Demo Account (last tab in PHPRunner) and send a link to it to support@xlinesoft.com

I'll help you to get this working.

scuba author 12/7/2007

I've transfered the project to demo-account. Please check for the error in table ges_dwh_v2 / Events / Add Page After

Thanks