This topic is locked
[SOLVED]

 email selected records sending only first record data in

11/30/2009 5:33:50 AM
PHPRunner General questions
A
anu author

Hello,
orders_list.htm

============================
<SPAN class=buttonborder>
<INPUT class=button onclick="frmAdmin.a.value='email'; frmAdmin.submit(); return false;"
value="Email selected" type=button>
</SPAN>

========================

3. Add the following code to the List page: Before process event.
if(@$_REQUEST["a"]=="email")

{
if(@$_REQUEST["selection"])

{

$body="";

foreach(@$_REQUEST["selection"] as $keyblock)

{

$arr=split("&",refine($keyblock));

if(count($arr)<1)

continue;

$keys=array();

$keys["OrderID"]=urldecode(@$arr[0]);

$where = KeyWhere($keys);
$rs = CustomQuery("select * from orders where $where");

$data=db_fetch_array($rs);
$body .= "OrderID: " . $data['OrderID'] . "\n";

$body .= "Customer: " . $data['CustomerID'] . "\n";

$body .= "Employee: " . $data['EmployeeID'] . "\n-------------------\n\n";
}
// send the email

$email="test@test.com";

$subject="Sample subject";

$arr = runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $body));
// if error happened print a message on the web page

if (!$arr["mailed"])

{

echo "Error happened:
";

echo "File: " . $arr["errors"][0]["file"] . "
";

echo "Line: " . $arr["errors"][0]["line"] . "
";

echo "Description: " . $arr["errors"][0]["description"] . "
";

}
}

}
I am using northwind database (livedemo3).
http://www.xlinesoft.com/phprunner/docs/email_selected_records.htm

copied the avove code from docs page.
After pressing Email selected button following details were mailed to my email;
OrderID: 10248

Customer: WILMK

Employee: 5

-------------------
OrderID: 10248

Customer: WILMK

Employee: 5

-------------------
OrderID: 10248

Customer: WILMK

Employee: 5

-------------------
OrderID: 10248

Customer: WILMK

Employee: 5

-------------------
OrderID: 10248

Customer: WILMK

Employee: 5

-------------------
OrderID: 10248

Customer: WILMK

Employee: 5

-------------------
OrderID: 10248

Customer: WILMK

Employee: 5

-------------------
OrderID: 10248

Customer: WILMK

Employee: 5

-------------------
What changes are required to email the all selected records instead of only first record.
Thanks,
--Anu

A
anu author 12/1/2009

Hello,
Can any one please help me to solve this problem,which I need uregently.

Thank you very much.

--Anu

J
Jane 12/2/2009

Anu,
It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error.

A
anu author 12/2/2009

Hi,
I have modified the mysql query,now everything works fine,with 'email selected' button.
outcomesid: 22

job stamp: 2009-11-27 15:04:16

script ID:2

-------------------
outcomesid: 17

job stamp: 2009-08-27 16:48:48

script ID:11

-------------------
--Anu