|
Posted by Queen Beryl on 04/26/06 04:26
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(some@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
[Back to original message]
|