mail problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nikko50
Forum Commoner
Posts: 43
Joined: Thu Apr 08, 2004 6:28 am

mail problem

Post by nikko50 »

Hi there. I have a crontab entry that runs the following code. The problem is the email only has a bunch of 1's. Probably it has to do with my $mailbody. Any suggestions as how I can print out this table correctly in an email.

$mailbody=print "<html><body>";
$query= "SELECT * FROM shiplist WHERE quantity > '0' ORDER BY store";
$result= mysql_query($query) or print(mysql_error());
$mailbody .= print "<p align=center><font size=4><b>Shiplist Report </b></font></p>";
$mailbody .= print "<br>";
$mailbody .= print "<table border=0 width=76% cellpadding=0 cellspacing=0 align=center bgcolor=#3366CC ";
$mailbody .= print "<tr>
<td width=11%> <p align=center><b><font color=#FFFFFF><a href=shiplistsort.php?order=date>Date</font></td>
<td width=8%><p align=center><b><font color=#FFFFFF><a href=shiplistsort.php?order=store>Store</font></td>
<td width=35%><p align=center><b><font color=#FFFFFF><a href=shiplistsort.php?order=equipment>Equipment</font></td>
<td width=6%><p align=center><b><font color=#FFFFFF><a href=shiplistsort.php?order=quantity>Qty</font></td>
<td width=17%><p align=center><b><font color=#FFFFFF><a href=shiplistsort.php?order=enteredby>Entered By</font></td>
<td width=8%><p align=center><b><font color=#FFFFFF></font></td>
<td width=6%><p align=center><b><font color=#FFFFFF></font></td>
</tr>
</table>";

while($line= mysql_fetch_array($result, MYSQL_ASSOC))
{
$get="select * from main where equipmentid='$line[equipmentid]'";
$getresult=mysql_query($get, $link) or print(mysql_error());
$getline=mysql_fetch_array($getresult, MYSQL_ASSOC) or print(mysql_error());
$mailbody .= print "<table border=0 width=76% cellpadding=0 cellspacing=0 onMouseover=\"changeto(event,'#99CCFF')\" onMouseout=\"changeback(event, '#EFEFEF')\" align=center bgcolor=#EFEFEF>";
$mailbody .= print "<tr>
<td width=11%>$line[date]</td>

<td width=35%>$getline[equipment]</td>
<td width=6%>$line[quantity]</td>
<td width=17%>$line[enteredby]</td>

</tr>
</table>";}

$mailbody .= print "</body></html>";
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

Remove 'print' e.g. ...

Code: Select all

$mailbody=print "<html><body>";
Should just be...

Code: Select all

$mailbody= "<html><body>";
nikko50
Forum Commoner
Posts: 43
Joined: Thu Apr 08, 2004 6:28 am

Post by nikko50 »

Works great. Thanks
Tracy
Post Reply