Let me just add that I am now able to retrieve data from the database (with WHERE clauses also). For some reason though I cannot use this information to send mails to various entries, echoing them only works to get them to print on screen. Let me show you what I've got:
PHP Code:
<?php
//Change these
$db = 'my_db';
$user = 'my_user';
$password = 'my_password';
if(!mysql_connect('localhost', $user, $password)) {
exit(mysql_error());
}
if(!mysql_select_db($db)) exit(mysql_error());
// Get a specific result from the "example" table
$result = mysql_query("SELECT * FROM `my_table`") or die(mysql_error());
// For multiple results
while($row = mysql_fetch_array($result)){
echo "Name: ".$row['name'];
echo "Email: ".$row['email'];
}
?>
<?php
// Create local PHP variables from the info the user gave
$email = echo .$row['email'];
// Strip slashes on the Local variables -disabled message field
$email = stripslashes($email);
$from = "myaccount@myhost.com";
$subject = "My Title";
//Begin HTML Email Message
$message = "This is my message";
echo ' ';
//end of message
$headers = "From: $from\r\n";
$headers = "Content-type: text/html\r\n";
$to = $email;
mail($to, $subject, $message, $headers);
exit();
?>
This line:
PHP Code:
$email = echo .$row['email'];
brings back this error:
Parse error: syntax error, unexpected T_ECHO in /home/bungle/public_html/MFPOI/email_delay.php on line 26
And when I instead use this:
PHP Code:
$email = $row['email'];
the retrieved data is shown on screen but the email is not sent.
Can anyone kindly enlighten me as to how to make the emails send to the results of the query.
_much obliged