Jump to content

Getting string from looped array


Drummin

Recommended Posts

Hello,

I'm going to be sending emails to users from a community calendar showing events for the day or a time frame specified elsewhere.  The problem I'm having is turning results of DB query into a string when there are multiple results for the day.  It works just fine with single results.  I understand why it doesn't work but can't figure out how to solve the problem.  Don't worry about the $eventdate as that comes from the same array as the $event_id used to call the array shown below.  I tried foreach and implode but couldn't get it working so I'm starting over and asking for your guidance on how is the best way to pull this off.  Thanks for your help.

 

 

$getevent = mysql_query("SELECT title, description from ".$conf['tbl']['events']." WHERE event_id=$event_id AND private=0");
WHILE ($gtevent = mysql_fetch_array($getevent)) {
$event_title=$gtevent['title'];
$event_description=$gtevent['description'];

$message="<p><span style=\"font-size:24px\">$event_title</span><br />$eventdate</p><p>$event_description</p>";

} 

 

Link to comment
https://forums.phpfreaks.com/topic/234418-getting-string-from-looped-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.