This topic is locked

Email with new data not incl lookup info

7/16/2007 8:32:50 PM
PHPRunner General questions
N
nzmark author

Please help I'm a newbie !
I am using the default action "send email with new data" after a record has been added to my table. The problem I am having is that several of the fields contain lookup data e.g clientcode link to the clients table. When the email is sent it includes the client code but what I would like it to show is the clientname from the client table the same as the lookup box uses.
Does anyone lknow how to do this ?

J
Jane 7/17/2007

Mark,
to select client name based on the client code in the event use following code:

global $conn;

$strSQL = "select ClientName from ClientTable where ClientCode=".$values["CliendCode"];

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

$data = db_fetch_array($rs);

echo $data["CliendName"];



where CliendName, CliendCode are your actual field names, CliendTable is your actual table name.

N
nzmark author 7/17/2007

Thanks
This worked a treat and taught me some coding as well !
Cheers

Mark,

to select client name based on the client code in the event use following code:
where CliendName, CliendCode are your actual field names, CliendTable is your actual table name.