473,378 Members | 1,417 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,378 software developers and data experts.

mysql and mail() function

Hi everyone

I am trying to send a e-mail using the mail() function.
Now i try to send more than one data from mysql database so i must use
example

$results=mysql_num_rows($result_query)
for(i=0; $i < $results; i++)
{
$row=mysql_fetch_array($result_query);
echo $row['name'];
echo " ";
echo $row['blabla'];
}

if i use mail() function one parametar must be variable example $text

I cant put more than one parameter in mail function or if i use $text
variable in string i cant put for()..etc

example

$text ="This is costumers names".
for(i=0; $i < $results; i++)
{
$row=mysql_fetch_array($result_query);
echo $row['name'];
echo " ";
echo $row['blabla'];
}." ..etc";

This is no working solution

mail(so**@some.so, help, $text);

I am new in php programing and i have no idea how to do this.
Thanks Ivan
Apr 25 '06 #1
2 2020
Bandul wrote:
Hi everyone

I am trying to send a e-mail using the mail() function.
Now i try to send more than one data from mysql database so i must use
example

$results=mysql_num_rows($result_query)
for(i=0; $i < $results; i++)
{
$row=mysql_fetch_array($result_query);
echo $row['name'];
echo " ";
echo $row['blabla'];
}

if i use mail() function one parametar must be variable example $text

I cant put more than one parameter in mail function or if i use $text
variable in string i cant put for()..etc

example

$text ="This is costumers names".

You are building a site for an amateur theatre company? Correct??
for(i=0; $i < $results; i++)
{
$row=mysql_fetch_array($result_query);
echo $row['name'];
echo " ";
echo $row['blabla'];
}." ..etc";

This is no working solution

I assume you mean that you want the loop to gather the information, and
then send it all in the one email at the end. If that's the case,
you've already been told the answer in alt.php. Something along the
lines of...

$text = "Customer's names\r\n"

for(i=0; $i < $results; i++)
{
$row=mysql_fetch_array($result_query);
$text .= $row['name'] . " " . $row['blabla'] . "\r\n";
}

Before you enter the loop, $text = "Customer's details" followed by a
carriage return and a line feed. Each time you go through the loop, the
contents of the fields 'name' and 'blabla' are added to $text followed
by a carriage return and a line feed. After you exit the loop,
everything you found in the loop is now in $text and is just begging for
you to mail it.

mail(so**@some.so, help, $text);

I am new in php programing and i have no idea how to do this.
Thanks Ivan


It's a good idea to cross post questions rather than ask the same
question in 2 different forums. That way people can see what
suggestions have already been made elsewhere.

B
Apr 26 '06 #2
I will, thanks for help.

"Queen Beryl" <hr******@sailormoon.not> wrote in message
news:4b************@individual.net...
Bandul wrote:
Hi everyone

I am trying to send a e-mail using the mail() function.
Now i try to send more than one data from mysql database so i must use
example

$results=mysql_num_rows($result_query)
for(i=0; $i < $results; i++)
{
$row=mysql_fetch_array($result_query);
echo $row['name'];
echo " ";
echo $row['blabla'];
}

if i use mail() function one parametar must be variable example $text

I cant put more than one parameter in mail function or if i use $text
variable in string i cant put for()..etc

example

$text ="This is costumers names".

You are building a site for an amateur theatre company? Correct??
for(i=0; $i < $results; i++)
{
$row=mysql_fetch_array($result_query);
echo $row['name'];
echo " ";
echo $row['blabla'];
}." ..etc";

This is no working solution


I assume you mean that you want the loop to gather the information, and
then send it all in the one email at the end. If that's the case, you've
already been told the answer in alt.php. Something along the lines of...

$text = "Customer's names\r\n"

for(i=0; $i < $results; i++)
{
$row=mysql_fetch_array($result_query);
$text .= $row['name'] . " " . $row['blabla'] . "\r\n";
}

Before you enter the loop, $text = "Customer's details" followed by a
carriage return and a line feed. Each time you go through the loop, the
contents of the fields 'name' and 'blabla' are added to $text followed by
a carriage return and a line feed. After you exit the loop, everything
you found in the loop is now in $text and is just begging for you to mail
it.

mail(so**@some.so, help, $text);

I am new in php programing and i have no idea how to do this.
Thanks Ivan


It's a good idea to cross post questions rather than ask the same question
in 2 different forums. That way people can see what suggestions have
already been made elsewhere.

B

Apr 26 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: William Drew | last post by:
REQUEST FOR DISCUSSION (RFD) unmoderated group comp.databases.mysql This is an invitation to discuss the following proposal to create newsgroup comp.databases.mysql. Please note that YOU...
0
by: Vladimir Espinosa Angarica | last post by:
Hi Team: I've found a bug in the example presented in the Official MySQL Manual in the section 9.1.15.6 A Simple Embedded Server Example. I tried to compile the program following the...
0
by: John R | last post by:
I found this old thread while looking for some type of compression solution myself. Long story short, I contacted Lester and ended up writing an LZO solution just as Mark had mentioned below....
0
by: bruce | last post by:
Hi... Update.... We have the following setup in our httpd.conf file. We've tried to give what's related to the issue. We're trying to set up a virtual host for a test project. The behavior...
0
by: Mark Adams | last post by:
I am a relative newbie to MySQL. I had a Postfix+Courier+MySQL mail server running for several months. It took me a week or so to get it up and running in September. Now, I did a clean upgrade to...
3
by: Mark Adams | last post by:
I am a relative newbie to MySQL. I had a Postfix+Courier+MySQL mail server running for several months. It took me a week or so to get it up and running in September. Now, I did a clean upgrade to...
0
by: Mark Adams | last post by:
I am a relative newbie to MySQL. I had a Postfix+Courier+MySQL mail server running for several months. It took me a week or so to get it up and running in September. Now, I did a clean upgrade to...
20
by: John Wells | last post by:
Yes, I know you've seen the above subject before, so please be gentle with the flamethrowers. I'm preparing to enter a discussion with management at my company regarding going forward as either...
1
by: Wessman | last post by:
sending mail using function mail() only works when I'm connected to mysql. <? mail($to, $subject, "before mysql_connect()", "From: $from"); mysql_connect("localhost", $username, $password);...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.