Hi, using the "foreach" way of printing out a SQL output, how can I, or can I get the variables to print for certain fields?
Example:
$result2 = mysql_query("SELECT *
FROM classifieds
WHERE TO_DAYS(NOW()) - TO_DAYS(dte) >= 120 AND email IS NOT NULL
ORDER BY dte");
print "<table border=1 cellspacing = 1 cellpadding = 2 bgcolor = #ffffff>\n";
while ( $a_row = mysql_fetch_row($result2))
{
print "<tr>\n";
foreach ($a_row as $field)
print "\t<td bgcolor=#ffffff>$field</td>\n";
print "</tr>\n";
//SEND EMAIL TO ADMIN
$to = "EMAIL ADDRESS HERE";
$subject = "Your classified ad has expired";
$email = "me@me.com";
$message = "
Hello! You are receiving this email because the classified ad that you submitted has expired and has been deleted from our database.\n
If you would like to repost the ad and extend it by another 120 days, you may do so now.\n
You original ad is below:\n\n
ORIGINAL AD SHOULD GO HERE
";
mail( $to, $subject, $message, "From: $email")
or print "Could not send mail";
Two of the fields that I need to get from the database are "email" and "descrip" - how can I get the contents of those two fields in a variable if I use "foreach"?
Am I making any sense?? =)
Thanks!