hi there Joad,
This is not a plug and play answer because you didn't explain what the name of the table was or, if only one user was getting an email, how to determine which mysql row we're supposed to get. This example will loop through the entire set of records, so every record would get their chance at customized email content.
<?
$mysql_connect = mysql_connect($host, $mysql_user, $mysql_password) ;
if(!$mysql_connect) {echo ("<P>Connection issues. No results displayed.</P>");}
$db_select = mysql_select_db($mysql_db);
if(!$db_select) {echo ("<P>Connection issues. No results displayed.</P>");}
/* You need to retrieve the user's name from the database */
$q_userdeets = "SELECT first_name FROM user_details";
$r_userdeets = mysql_query ($q_userdeets) or die('Query failed');
$num_userdeets = mysql_num_rows($r_userdeets);
if($num_userdeets == 0){
/* No users found. That means, no user info */
/* You could end the script, use anonymous info or just continue on.*/
}else{
while ($row_userdeets = mysql_fetch_assoc ($r_userdeets)) {
$first_name = $row_userdeets['first_name'];
/* More user details could be grabbed from that table here */
/* Your mail needs to be sent out here, inside the while loop
if you want all users to get a mail. Otherwise, you would end
with just the last record's data. */
$subject = "Subject Text";
$body = "Hello, ".$first_name."! \r\n
\r\n
Body text";
$event_date = '2015-01-31'; //Y-m-d FORMAT
}
}
?>
We can answer in more detail if you give us more info to work with.