Jump to content


Photo

Email MySQL array results


  • Please log in to reply
2 replies to this topic

#1 djones

djones
  • Members
  • PipPipPip
  • Advanced Member
  • 74 posts
  • LocationWinston-Salem, NC

Posted 06 October 2006 - 03:50 AM

How can I email the results of a MySQL array (loop). For example:

while ($myrow = mysql_fetch_array($result)){

$field = $myrow["field"]; // Will return multiple rows

}

Now I need to mail the results above only once. I know how to use the mail function.

#2 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 06 October 2006 - 07:04 AM

You could do something like this.

$field = "begin list<br />";
while ($myrow = mysql_fetch_array($result)){
   $field .= $myrow['field'] . '<br />';.
}

$to = "someone";
$subject = "something";
$message = 'The is a list of someting: ' . $field;
//now send the message

Hope that helps,
Tom


Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#3 djones

djones
  • Members
  • PipPipPip
  • Advanced Member
  • 74 posts
  • LocationWinston-Salem, NC

Posted 06 October 2006 - 12:10 PM

Yes that worked. Thanks.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users