473,672 Members | 2,597 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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($resul t_query)
for(i=0; $i < $results; i++)
{
$row=mysql_fetc h_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_fetc h_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 2032
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($resul t_query)
for(i=0; $i < $results; i++)
{
$row=mysql_fetc h_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_fetc h_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_fetc h_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******@sailo rmoon.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($resul t_query)
for(i=0; $i < $results; i++)
{
$row=mysql_fetc h_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_fetc h_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_fetc h_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
2680
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 CANNOT VOTE NOW; you may be able to vote on a version of this proposal later. See the PROCEDURE section below if you need information about how the discussion works. PLEASE POST ANY FOLLOWUPS TO THE NEWSGROUP NEWS.GROUPS.
0
1560
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 instructions depicted in the manual and a compiling error arose. The error was: gcc -g -W -Wall -I/usr/local/mysql/include -D_THREAD_SAFE -D_REENTRANT -c -o test_libmysqld.o test_libmysqld.c test_libmysqld.c: In function `db_do_query':
0
1717
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. Thought this could also benifit someone out there so I'm reposting. Here's a link to the source code: http://www.servangle.net/udf_lzo/ BTW, Lester got his zlib implementation working as well. Hopefully these will both be posted on MySQL website...
0
2028
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 that we're seeing is that we can type: http://foo.com but the url that gets displayed is
0
1332
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 Mandrake 9.2 and am reinstalling everything. MySQL is kicking my ass and I can't seem to get past it to install everything else. I have it installed and I can start the server through Webmin, but the process runs away -- I get a series of...
3
863
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 Mandrake 9.2 and am reinstalling everything. This thing is kicking my ass and I can't seem to get past it. I could really use some help if anybody has any. Just for reference, this was my primary source for information on installation and...
0
5838
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 Mandrake 9.2 and am reinstalling everything. This thing is kicking my ass and I can't seem to get past it. I could really use some help if anybody has any. Just for reference, this was my primary source for information on installation and...
20
1509
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 a MySql shop or a Postgresql shop. It's my opinion that we should be using PG, because of the full ACID support, and the license involved. A consultant my company hired before bringing me in is pushing hard for MySql, citing speed and community...
1
1307
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); mail($to, $subject, "after mysql_connect()", "From: $from"); ?> The above code results in a single e-mail containing "after
0
8404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8931
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8828
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8608
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7446
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5705
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4418
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2063
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.