Page 1 of 1

Get the Data from a while mysql_fetch_array

Posted: Fri Jun 27, 2008 7:55 am
by akbbell
Greetings,

Starting off Highlevel: I am trying to perform a query of my database and email the person who filled out the form the results. I am able to setup the form submission, perform the query and echo all of the results out to the screen using while and the mysql_fetch_array. I can add the email code to send the information after each result. However, I want the user to only receive one email.

How do I send all of the results in one email?

Thanks,

Akbbell

Re: Get the Data from a while mysql_fetch_array

Posted: Fri Jun 27, 2008 9:18 am
by jayshields
Loop through the results concatenating the results onto the end of the email body, then sending the email using the constructed body afterwards? I don't really know what you're saying, you need to be talking lower level! :D

Re: Get the Data from a while mysql_fetch_array

Posted: Fri Jun 27, 2008 9:29 am
by akbbell
That works exactly the way I needed. I was thinking I needed to do some sort of for loop to get all of the data. All I needed to do was put the data in a concatenated string.

$var ='';
while($row = mysql_fetch_array($query)){
$var .= "Message: $row[data];
}

I can send my email with $var data which is now text of all of the results.

Thanks,