This topic is locked

Problem Getting The Basic 'email Selected Records' To Work.

1/23/2013 1:26:04 AM
PHPRunner General questions
D
DUKE author

Hi Everyone,
I am testing the basic 'email selected records' on my server. I can not get it to work : it returns an error each time I click the button.
Here's the coding. I have changed a few of the name to fit my Database.
global $dal;

$dal_TableName = $dal->Table("weighbills");

$body="";

foreach(@$keys as $keyblock)

{

$arr=explode("&",refine($keyblock["Weighbill"]));

if(count($arr)<1)

continue;

$arr2=array();

$arr2["Weighbill"]=urldecode(@$arr[0]);

$where = KeyWhere($arr2);

$rstmp = $dal_TableName->Query($where,"");

$datatmp=db_fetch_array($rstmp );

$body .= "Date: " . $datatmp['Date'] . "\n";

$body .= "Branch: " . $datatmp['Branch'] . "\n";

$body .= "Client: " . $datatmp['Client'] . "\n";

$body .= "Route: " . $datatmp['Route'] . "\n";

}
// send the email

$email="xxxxxx@xxxx.xxx";

$subject="Sample subject";

$arr = runner_mail(array('to' => $email, 'subject' => $subject,

'body' => $body));

$result["txt"] = "Emails were sent.";
// if error happened print a message on the web page

if (!$arr["mailed"])

{

$errmsg = "Error happened:
";

$result["txt"] = $errmsg;

}

C
cgphp 1/23/2013

If you are using PHPrunner 6.2, you can use this solution instead: http://xlinesoft.com/phprunner/docs/button_getnextselectedrecord.htm