PHP - Pull data from mysql and e-mail
<p>In the code below, I can run the sql through phpMyAdmin and it will return a result. It does not throw any php errors on the browser. I can't seem to get it to send out e-mail.</p>

<pre><code>&lt;?php
ini_set('display_errors',1);
 error_reporting(E_ALL);
include('database.inc.php'); // Our database connectivity file
?&gt;
&lt;?php
$reminder_date = "t1.`reminder_date`";
$email = "t1.`reminder_email`";
$reminder_name = "t1.`reminder_name`";
$reminder_details = "t1.`reminder_desc`";
$server = "reminder@teamcrr.com";

$sql = "SELECT t1.`reminder_id` , t1.`reminder_name` , t1.`reminder_desc` , t1.`reminder_date` , t1.`reminder_email` , lp4.`email` AS `lp_reminder_email`
FROM `reminder_events` AS t1
LEFT OUTER JOIN `authorize` AS lp4 ON ( t1.`reminder_email` = lp4.`email` )
WHERE reminder_date &lt;= NOW( )
ORDER BY `reminder_date` ASC";

$result = mysql_query($sql) or die(mysql_error());

while( $row = mysql_fetch_array( $result ) )
?&gt;
&lt;?php
 $to = "$email";
 $from = "$server";
 $headers = "$from";
 $subject = "$reminder_name";
 $body = "$reminder_details";


 {
 $send = mail($to, $subject, $body, $headers);
 }

 ?&gt;
</code></pre>

<p>Anyone tell me what I'm doing wrong?
Thanks.</p>
