can anyone help me with this........
SELECT
(Call.Call_Num) AS 'Call Number',
(Call.AssignTo) AS 'Assigned To',
(Call.OpenDate) AS 'Opened On',
(Call.Summary) AS 'Summary',
ISNULL(Event.Memo, '') AS 'Last Update',
(Event.ChangeDate) AS 'Last Updated On'
FROM Call
LEFT JOIN Event ON Call.Call_ID = Event.Call_ID
WHERE
Call.Status = 'OPEN'
AND
Call.Priority = '1'
AND
Event.ChangeDate = (select max(ChangeDate) from Event as tmp where tmp.call_id = call.call_id)
ORDER BY Call.Call_Num DESC , Event.ChangeDate DESC;
";
$rs = odbc_exec($db, $sql);
while (odbc_fetch_row($rs))
{
$callnum=odbc_result($rs,"Call Number");
$assto=odbc_result($rs,"Assigned To");
$openon=odbc_result($rs,"Opened On");
$summary=odbc_result($rs,"Summary");
$memo=odbc_result($rs,"Last Update");
$updateon=odbc_result($rs,"Last Updated On");
echo "<tr><td>$callnum<br></td>";
echo "<tr><td>$assto<br></td>";
echo "<tr><td>$openon<br></td>";
echo "<tr><td>$summary<br></td>";
echo "<tr><td>$memo<br></td>";
echo "<tr><td>$updateon<br></td>";
}
echo "</table>";
$to = "######@#####.com";
$subject = "Priority 1 Incidents";
$message = "$callnum,$assto,$openon,$summary,$memo,$updateon";
$from = "Customer Support Interface";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
the problem I have is the sql returns all rows which is great but $message only contains the last row and it needs to contain all rows..
please help
😕