From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]

> Hi, can anyone tell me what is the problem of my script:
> 
> $sql2 = "SELECT * FROM Cash WHERE HP='$HP' and 
> SignUpDate='$SignUpDate'";
>    $rows1 = mysql_query($sql2,$linkptr1) ;
>         
>    
>    $OwnnerMail ="[EMAIL PROTECTED]";
>    $Subject = "Testing";
>                     
>    while ( $row = mysql_fetch_array($rows1) ) { 
>    
>    $newvalue = $row["Password"];  
>    echo "$newvalue\n";
>    
>    
>  }
>    $Body = $newvalue;
>    $From = "$HP";
>    mail( $OwnnerMail,$Subject, $Body, "From: $From");   
> 
> I can see all the data for $newvalue in browser.  But, when i 
> receive email, i can only see the last data.
> 
> can i know what is the problem?  thank you.


Your script is doing exactly what you told it to. After the while() loop, $newvalue is 
set to the last member of $row["Password"].

Try something like this...

====================================
$sql2 = "SELECT * FROM Cash WHERE HP='$HP' and SignUpDate='$SignUpDate'";
$rows1 = mysql_query($sql2,$linkptr1);

$OwnnerMail ="[EMAIL PROTECTED]";
$Subject = "Testing";
$Body = "";

while ( $row = mysql_fetch_array($rows1) ) { 

        $newvalue = $row["Password"];  
        echo "$newvalue\n";
        $Body .= "$newvalue\n";

}

$From = "$HP";
mail( $OwnnerMail,$Subject, $Body, "From: $From");   
====================================

See how $Body is initialized before the while() loop, and then appended to using .= 
inside the loop? Once the loop completes, $Body contains all values of 
$row["Password"], not just the last one.



-- 
Mike Johnson
Web Developer/Systems Asst.
Smarter Living, Inc.
phone (617) 497-2500 x226

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to