script not looping right!
| From: | Rodney Davis | Date: | Tue, 31 Oct 2000 22:07:54 +0000 |
| Subject: | script not looping right! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-23022@lists.php.net to get a copy of this message | ||
Can some look at the script that follows and tell me why I only get one
variable
back in the mail when I should be getting back 34? I have tried and just
can't
figure out what I am doing wrong.
thanks in advance
rodney
[snip]
function sendToSnap ($session_id) {
global $link;
$result = mysql_query ("SELECT answer FROM answers
WHERE id='$session_id'", $link);
if (!$result)
die ("sendToSnap fatal error: ".mysql_error());
if (mysql_num_rows($result))
{
while ($row= mysql_fetch_array($result))
$answer = $row[answer];
$msg = "$answer \n";
}
$mailheaders = "From: somewhere.com \n";
$mailheaders .= "Reply-To: someone@somecompany.com \n\n";
$mailTo = "rodney@wincubic.com";
if(mail ($mailTo, "somecompany.com", $msg, $mailheaders))
{
print ("It sent");
}
else
{
print ("It didn't send");
}
}
else die ("Error");
return false;
}
[snip]