467,146 Members | 1,293 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,146 developers. It's quick & easy.

email message body from mysql data

I need to have a php script pull data from a mysql table and send it
in the body of an email

I know I can get the script to display information in the browser by
doing this:

$i=0;
while ($i < $num) {

$who=mysql_result($result,$i,"who");
$where=mysql_result($result,$i,"where");

echo "<b>$who</b><br>$where<hr><br>";

$i++;
}
and the output will look like:

john
toronto
If I use:

$message = "message text goes here";

I can get an email where the message reads "message text goes here"
how do I replace "message text goes here" with the information from
the mysql table
Mar 20 '08 #1
  • viewed: 1807
Share:
4 Replies
ca******@gmail.com wrote:
I need to have a php script pull data from a mysql table and send it
in the body of an email

I know I can get the script to display information in the browser by
doing this:

$i=0;
while ($i < $num) {

$who=mysql_result($result,$i,"who");
$where=mysql_result($result,$i,"where");

echo "<b>$who</b><br>$where<hr><br>";

$i++;
}
and the output will look like:

john
toronto
If I use:

$message = "message text goes here";

I can get an email where the message reads "message text goes here"
how do I replace "message text goes here" with the information from
the mysql table

you are kidding right?

How about $message = $who."\n".$where;

Mar 20 '08 #2
ca******@gmail.com wrote:
>I need to have a php script pull data from a mysql table and send it
in the body of an email

I know I can get the script to display information in the browser by
doing this:

$i=0;
while ($i < $num) {

$who=mysql_result($result,$i,"who");
$where=mysql_result($result,$i,"where");

echo "<b>$who</b><br>$where<hr><br>";

$i++;
}
and the output will look like:

john
toronto
If I use:

$message = "message text goes here";

I can get an email where the message reads "message text goes here"
how do I replace "message text goes here" with the information from
the mysql table
We cannot tell you as there is insufficient information here to tell where
that data is stored.
Mar 21 '08 #3
On Mar 20, 6:32 pm, Michael Austin <maus...@firstdbasource.comwrote:
canaj...@gmail.com wrote:
I need to have a php script pull data from a mysql table and send it
in the body of an email
I know I can get the script to display information in the browser by
doing this:
$i=0;
while ($i < $num) {
$who=mysql_result($result,$i,"who");
$where=mysql_result($result,$i,"where");
echo "<b>$who</b><br>$where<hr><br>";
$i++;
}
and the output will look like:
john
toronto
If I use:
$message = "message text goes here";
I can get an email where the message reads "message text goes here"
how do I replace "message text goes here" with the information from
the mysql table

you are kidding right?

How about $message = $who."\n".$where;
unfortunately I'm not kidding, we have a form that sends to a
database, I tried to get to get it to send an email at the time the
form is submitted when a certain condition is met but no-one seems to
know how to do it, so the next best thing was to write a php script
and run a cron job with wget to search the database once a day looking
for entries that meet the criteria and send the email to the people
who need it

tried your suggestion, but it didn't work :( no email gets sent, but
it does give me some ideas

thanks
Mar 21 '08 #4
ca******@gmail.com wrote:
On Mar 20, 6:32 pm, Michael Austin <maus...@firstdbasource.comwrote:
>canaj...@gmail.com wrote:
>>I need to have a php script pull data from a mysql table and send it
in the body of an email
I know I can get the script to display information in the browser by
doing this:
$i=0;
while ($i < $num) {
$who=mysql_result($result,$i,"who");
$where=mysql_result($result,$i,"where");
echo "<b>$who</b><br>$where<hr><br>";
$i++;
}
and the output will look like:
john
toronto
If I use:
$message = "message text goes here";
I can get an email where the message reads "message text goes here"
how do I replace "message text goes here" with the information from
the mysql table
you are kidding right?

How about $message = $who."\n".$where;

unfortunately I'm not kidding, we have a form that sends to a
database, I tried to get to get it to send an email at the time the
form is submitted when a certain condition is met but no-one seems to
know how to do it, so the next best thing was to write a php script
and run a cron job with wget to search the database once a day looking
for entries that meet the criteria and send the email to the people
who need it
Get someone competent to do your scripting. It should be a pretty minor
matter to add this to the script which stores data in the database.
tried your suggestion, but it didn't work :( no email gets sent, but
it does give me some ideas

thanks
It's not that hard in many cases, but can be very difficult in others.
It depends mainly on how your email server is set up.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Mar 21 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by mike | last post: by
reply views Thread by I am Sam | last post: by
6 posts views Thread by chris_fieldhouse@hotmail.com | last post: by
4 posts views Thread by Ken D. | last post: by
5 posts views Thread by 5070707@gmail.com | last post: by
ddtpmyra
3 posts views Thread by ddtpmyra | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.