Ok, well I appreciate all of your help so far. I am obviously new to php and mysql and I've been reading two books trying to work my way through this. understand how to use the mail funstion and how to place info from a database into a variable for email or whatever. This is what I've got so far:
<?php
require_once ('mysql_connect.php');
$query = "SELECT * FROM tickets WHERE user_id = 4 ORDER by ticket_from"; //query the database
$result = @mysql_query ($query);
if ($result) {//if everything is ok...
echo '<h4><font color="#003396">Current Fares for $company_name</font></h4>
<p class=\"alert\">***Fares are one-way non directional, and include all taxes and surcharges.***</p>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="18%" bgcolor="#CECECE" align="left"><b>From</b></td>
<td width="18%" bgcolor="#CECECE" align="left"><b>To</b></td>
<td width="18%" bgcolor="#CECECE" align="center"><b>Price</b></td>
<td width="10%" bgcolor="#CECECE"> </td>
</tr> ';
while($row = mysql_fetch_array($result, MYSQL_NUM)){//define variables
$ticket_from = $row[3];
$ticket_to = $row[4];
$ticket_price = $row[5];
$num++;
if ($c == "#FFFFFF") { $c = "#F3F3F3"; } else { $c = "#FFFFFF"; }//alternates table row colors
echo " <tr>
<td width='18%' bgcolor='$c' align='left'>$ticket_from</td>
<td width='18%' bgcolor='$c' align='left'>$ticket_to</td>
<td width='18%' bgcolor='$c' align='center'>$ticket_price</td>
</tr>\n";
}
echo '</table>';
mysql_free_result ($result);
} else {
echo '<p>The info could not be displayed due to a system error.</p><p>' . mysql_error() . '</p>';
}
mysql_close();
?>
Where I'm stuck is how to get that information into a variable for email. The script currenty populates the table with as many tickets as there are in the database, which is what I want. So I'm not sure if this is how I need to pull the info from my DB or if there is a better way to do this.
As I said. you put everything into a variable.
So if you have n1, 2, 12, or 1000 items to send, you create the items, and put them together:
$mail_message = $var1.$var2.$vari;
How would this work with my code so far?
Thanks for all of your help so far. I feel like the answer is staring me in the face.