Here is what I am trying to do...
Search a database for people that want to receive a newsletter (works)
Get the e-mail address and business code (works)
Get the business name for the newsletter based on #2 (works)
Get the specials for the business for the day of the week (works)
Send an e-mail to each person (1) including the business name (3) and the daily specials (4) (kinda works)
We will say that the business has 3 specials for the day. Everything works except for including all the specials for the day in the e-mail. All I can get it to do is display the last special, not all 3.
Here is the code I have tried...
Obviously, there is code above, but this is the relevant code...
//See if restaurant has specials for today
$specquery=("SELECT * FROM menuitems WHERE RestaurantID='$newsrow[RestaurantID]' AND $DayToday='Yes'");
$specresult=mysql_query($specquery) or die('Query failed. ' .mysql_error());
$specrow=mysql_fetch_array($specresult);
//Count the specials
$speccount=mysql_num_rows($specresult);
//If restaurant has specials
if($speccount >= 1)
{
$TO="$email";
$SUBJECT="Daily Specials and Coupons for $restname";
//Get the menu items
while($specrow=mysql_fetch_array($specresult))
{
$itemname=$specrow[Name];
$itemdesc=$specrow[Description];
$itemprice=$specrow[Special];
}
$TEXT="$itemname - $itemdesc - $itemprice";
mail($TO, $SUBJECT, $TEXT, $HEADERS);
}
I have also tried this... Same result...
//Get the menu items
while($specrow=mysql_fetch_array($specresult))
{
$itemname=$specrow[Name];
$itemdesc=$specrow[Description];
$itemprice=$specrow[Special];
[B]$TEXT="$itemname - $itemdesc - $itemprice";[/B]
}
Like I said, everything works except it only sends the last special, not all 3.
Thanks in advance.