473,320 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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
4 2027
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: dave | last post by:
I am trying to generate an email from the webpage using code below, which works fine. However I want to be able to include some dyanmic data how do I go about it ?can anybody point me in the...
6
by: mike | last post by:
I have created a side application in VB.NET which reads rows from a DB and builds an email message. when i have a long string the the mailmessage.body or the mailmessage, it puts in an...
2
by: Nigi | last post by:
I've made a mysql database with php front end which, in part, contains mailing lists. I've used a mailto: link to create a new email with their names in the bcc: field. Unfortunatley their is a...
3
by: Zman | last post by:
I've recently added form functionality on my website, which runs with the aid of a perl script and sends the results via an email message. I'm currently able to import, or link, data from a...
0
by: I am Sam | last post by:
Ok I don't know what is the problem with my code But I am trying to build a newsletter that gathers parameters from 3 textbox controls and a Listbox control. The form then queries the event table...
6
by: chris_fieldhouse | last post by:
Hi, I have a script for processing emails, The script finds email sent to a particular alias, grabs the body text of the email and stores it into a database. Problem is that certain character...
4
by: Ken D. | last post by:
I have an asp page that collects data on referrals. The user inputs the information and selects the rep to receive the referral. My data is being saved to a backend database (SQL) and the user is...
5
by: 5070707 | last post by:
Hi all! I have a small form build with visual studio 2005 (Visual Basic) in that form i have some text boxes and some combos. these are being field by the users followed by an mail submit button...
3
ddtpmyra
by: ddtpmyra | last post by:
Need help as a newbie I'm trying to create auto email everytime the users execute the button below. Please tell me what wrong with my mail.php file <html> <head> ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.