I have a session array [cart] of which contains user id numbers. I am trying to generate a list of email addresses from the contact table WHERE the contact id numbers in the session = the contact_id in the database.
Here is my code.
// Find cart members from the session array
foreach ($_SESSION['cart'] as $key=>$val) {
$contactid = $val;
// Query the database for cart members
$cartresult = mysql_query("SELECT contact.email FROM contact WHERE contact.contact_id = '$contactid'");
$emailresult = mysql_query($emailquery) or DIE (mysql_error());
while ($r = mysql_fetch_array($emailresult)) {
$emailAry[] = $r['email'];
}
}
// Create comma separated list from email array
if (count($emailAry)) {
$list = implode(", ", $emailAry);
$list = str_replace(" ,", "", $list);
Apparently there is no value for $emailAry because the if statement is being neglected.
Any idea why this would be?
$emailqueryfrom my perspective is undefined.