I have included snippets of my code that does work (and emails one record just how i want it to go) and the steps taken to get there.
1) $row->id gets sent to email function (with other data) when user presses save on a form.
2) Here is mysql statement to get the data I want to show in the table from the database
Code: Select all
//Get Service Details
$row->id = strip_tags($_POST['id']);
$query = "SELECT * FROM #__jservicerelation INNER JOIN #__jservices on #__jservicerelation.serviceid = #__jservices.id WHERE invoiceid=$row->id";
$database->setQuery($query);
$appliedservices = $database->loadAssoc();
$num=mysql_numrows($appliedservices);
$qty = $appliedservices['quantity'];
$desc = $appliedservices['productname'];
$list = $appliedservices['listprice'];
$totalcost = $appliedservices['listprice'] * $appliedservices['quantity'];4. To create a table with a single record - I am using this and it works perfect. I need to obviously change this to include subsequent lines of the string
Code: Select all
$message .= '<table rules="all" style="border: 1px solid #DDD;" cellpadding="10">';
$message .= "<tr><td><strong>Qty</strong> </td><td><strong>Description</strong> </td><td><strong>Net Price</strong> </td><td><strong>Total</strong> </td></tr>";
$message .= "<tr><td>" . strip_tags($qty) . "</td><td>" . strip_tags($desc) . "</td><td>" . strip_tags($list) . "</td><td>" . strip_tags($totalcost) . "</td></tr>";
$message .= "</table>";