Only getting results from the last item in the array.
| From: | mailing | Date: | Sun, 11 May 2003 01:02:25 +0000 |
| Subject: | Only getting results from the last item in the array. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-147145@lists.php.net to get a copy of this message | ||
Hi
I have an array $todaycatname which contains category names, and I have an array $email containing
email addresses.
I need to send email to all addresses that have requested the category in $todaycatname.
At the moment I am only sending email it to the last category in the $todaycatname array, rather
than all of them.
Any help, really appreciated.
Many thanks
If it helps....I am making the select statement like this:
$sql_cat1 ="select * from category where latest_date = '$today' ";
$result = @mysql_query($sql_cat1) or die(mysql_error());
while ($row =mysql_fetch_array($result))
{
$todaycatname = $row["catname"];
$todaycatid = $row["catid"];
echo "Category name = <B> $todaycatname</B> with category ID =
<B>$todaycatid</B> <BR>" ;
}
then later.......
$sql_email = "select distinct email from $usr_tbl where usr_4 like
'$todaycatname'";
$result = mysql_query ($sql_email);
$num_email = mysql_num_rows($result);
while ($row = mysql_fetch_array($result))
{
$email = $row["email"]; }
(usr_4 contains a string that holds the chosen categories.