Jump to content

email query results


soldbychris

Recommended Posts

I have a php script that rotates a daily message from my mysql database.

 

How do I include that query information in the body of a email.

 

 

Here is the script 

 

Any assistance would be appreciated.

 

 

 

$query = "SELECT `Date`,`Email`,`Par1`,`Par2`,`Par3`,`Par4`,`Par5` FROM `Emailing` WHERE DATE_FORMAT(Date,'%Y-%m-%d') = CURDATE()";

 

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

 

 

while($row = mysql_fetch_array($result)){

echo "<h1>Real Estate Term of the Day</h1>";

echo "$Date".$row['Date'];

echo "<br>";

    echo "<br>";

    echo "$Par1".$row['Par1'];

    echo "<br>";

    echo "<br>";

    echo "$Par2".$row['Par2'];

    echo "<br>";

    echo "<br>";

    echo "$Par3".$row['Par3'];

    echo "<br>";

    echo "<br>";

    echo "$Par4".$row['Par4'];

    echo "<br>";

    echo "<br>";

    echo "$Par5".$row['Par5'];

    echo "<br>";

    echo "<br>";

}

 

$to = "email";

$subject = "Hi!";

$body = "$Par1".$row['Par1'];

$headers = "From: email";

if (mail($to, $subject, $body)) {

  echo("<p>Message successfully sent!</p>");

} else {

  echo("<p>Message delivery failed...</p>");

}

 

 

?>

 

Link to comment
Share on other sites

Thanks

 

I am taking a crash course in figuring it out.

 

I have managed to get everything working but one thing

 

How do you include a hyperlink in the body of the php generated email without it showing as text after receiving the email.

 

 

Any assistance would be appreciated

 

 

 

Link to comment
Share on other sites

I guess that is what I have to do.

 

I will have several links in the email and would like to have hyperlinks.

 

Its been hard trying to find something about it. 

All of my searching only shows up how to add a link to a php email form.

Not how to include a link in a email send using php script.

 

Thanks

 

 

Link to comment
Share on other sites

Replace this code in your code, i think, then you got solution

 

while($row = mysql_fetch_array($result)){

  $message = "<h1>Real Estate Term of the Day</h1>";

    $message .= "<br>Date".$row['Date'];

    $message .=  "<br>Par1".$row['Par1'];

    $message .=  "<br>Par2".$row['Par2'];

    $message .=  "<br>Par3".$row['Par3'];

    $message .=  "<br>Par4".$row['Par4'];

    $message .=  "<br>Par5".$row['Par5'];

 

}

 

$to = "email";

$subject = "Hi!";

$body = $message;

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.