I, My stack on something and really seems not get better. Is it possible to have a script that fetch individually each client row data and send it to their email address? Still trying but I can't find answer.
Anyone with great suggestions?
here is my code:
<?php
$sqlSelect = "SELECT
cl.client_name,
DATE(jb.date),
jb.job_number,
jb.repair,
st.site_name
FROM
job_cards jb
INNER JOIN
clients cl ON (cl.client_id = jb.client_id)
LEFT JOIN
sites st on (st.site_id = jb.site_id)
WHERE
jb.completed = 1
AND cl.client_id = jb.client_id
ORDER BY cl.client_name ASC";
$tresult = mysql_query($sqlSelect);
while($userData = mysql_fetch_assoc($tresult))
{
if($i%2==0)
$classname = 'evenRow';
else if($i%2==1)
?>
<tr class='<?php if(isset($classname)) echo $classname;?>'>
<td width=250>
<?php
//echo $userData['client_name)'];
echo mysql_real_escape_string ($userData['client_name]); ?>
</td>
<td width=100>
<?php echo mysql_real_escape_string ($userData['DATE(jb.date)']); ?>
</td>
<td width=50>
<?php echo mysql_real_escape_string($userData['job_number']);?>
</td>
<td>
<?php echo mysql_real_escape_string($userData['site_name']);?>
</td>
<td>
<?php echo mysql_real_escape_string($userData['repair']);?>
</td>
<?php
$to .= "realconcept@usa.com";
$subject ="Monthly Reports for company";
$headers .='MIME-Version: 1.0' . "
";
$headers .= 'Content-type: text/html;charset=iso-8859-1' . "
";
$headers .= 'From: System Admin <mike@guardre.com>' . "
";//<noreply@example.com>'
$message .="
Company Name : ".$userData['client_name']."
".
"Date : ".$userData['DATE(jb.date)']."
".
"Site : ".$userData['site_name']."
".
"Description : ".$userData['repair']."
";
if(mail('realconcept@usa.com', $subject, $message, $header))
$i++;
}
?>
**What is wrong with my code?**s