Drummin Posted April 22, 2011 Share Posted April 22, 2011 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>"; } Quote Link to comment https://forums.phpfreaks.com/topic/234418-getting-string-from-looped-array/ Share on other sites More sharing options...
spiderwell Posted April 22, 2011 Share Posted April 22, 2011 add the . concatenator to $message should do it, thus each loop will add to the message string as events are looped $message .="<p><span style=\"font-size:24px\">$event_title</span><br />$eventdate</p><p>$event_description</p>"; Quote Link to comment https://forums.phpfreaks.com/topic/234418-getting-string-from-looped-array/#findComment-1204781 Share on other sites More sharing options...
Drummin Posted April 22, 2011 Author Share Posted April 22, 2011 Oh man how did I miss that. Worked great! Thanks for your help! Quote Link to comment https://forums.phpfreaks.com/topic/234418-getting-string-from-looped-array/#findComment-1204909 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.