mysql and mail() function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bandul

    #1

    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(some@some. so, help, $text);

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


  • Queen Beryl

    #2
    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($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".[/color]


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

    [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

    Comment

    • Bandul

      #3
      Re: mysql and mail() function

      I will, thanks for help.

      "Queen Beryl" <hrhberyl@sailo rmoon.not> wrote in message
      news:4b80imFvu0 38U1@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($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".[/color]
      >
      >
      > You are building a site for an amateur theatre company? Correct??
      >[color=green]
      >> 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
      >>[/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_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.
      >
      >[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]


      Comment

      Working...