Connecting Tech Pros Worldwide Forums | Help | Site Map

mysql and mail() function

Bandul
Guest
 
Posts: n/a
#1: Apr 25 '06
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(some@some.so, help, $text);

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



Queen Beryl
Guest
 
Posts: n/a
#2: Apr 26 '06

re: mysql and mail() function


Bandul wrote:[color=blue]
> 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".[/color]


You are building a site for an amateur theatre company? Correct??
[color=blue]
> 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
>[/color]

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.

[color=blue]
> mail(some@some.so, help, $text);
>
> I am new in php programing and i have no idea how to do this.
> Thanks Ivan
>
>[/color]

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
Bandul
Guest
 
Posts: n/a
#3: Apr 26 '06

re: mysql and mail() function


I will, thanks for help.

"Queen Beryl" <hrhberyl@sailormoon.not> wrote in message
news:4b80imFvu038U1@individual.net...[color=blue]
> Bandul wrote:[color=green]
>> 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".[/color]
>
>
> You are building a site for an amateur theatre company? Correct??
>[color=green]
>> 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
>>[/color]
>
> 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.
>
>[color=green]
>> mail(some@some.so, help, $text);
>>
>> I am new in php programing and i have no idea how to do this.
>> Thanks Ivan
>>
>>[/color]
>
> 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[/color]


Closed Thread