I have a page that lists events for our stores. These events are kept in a database. If I have 2 events for some of my stores, when displaying them on the page, I get:
“bullet” first event
“bullet” first event again
second event (notice no bullet icon)
What I want isL
“bullet” first event
“bullet” second event
Here is the code for my loop when looping through the events for a particular store number:
[code]
<?php
// now go through and see if there’s anything in $event for this
// store and for each thing we find, spit out a row telling about
// it….
$this_store = intval($key);
for ($i=0; $i< @count($events); $i++) {
// don’t even look at the data if it’s not for the location
// we’re currently displaying
if ($this_store != intval($events[$i][locn]) ) {
continue;
}
$_type = $events[$i][event_type];
switch ($_type) {
case “flu_clinic”:
$_name = “Flu Clinic”;
break;
case “diabetes_clinic”:
$_name = “Diabetes Clinic”;
break;
case “health_beauty_expo”:
$_name = “Baltimore Health & Beauty Expo”;
break;
case “six_flags”:
$_name = “Six Flags Magic Mountain Season Passes”;
break;
}
list ($start_year, $start_month, $start_day) = split (‘[/.-]’, $events[$i][event_start_date]);
$_date=date(‘F j, Y’,mktime(0,0,0,$start_month,$start_day,$start_year));
list ($end_year, $end_month, $end_day) = split (‘[/.-]’, $events[$i][event_end_date]);
$_end_date=date(‘F j, Y’,mktime(0,0,0,$end_month,$end_day,$end_year));
$_start_time = trim($events[$i][event_start_time]);
$_end_time = trim($events[$i][event_end_time]);
$_url = trim($events[$i][event_url]);
$_additional_info = trim($events[$i][additional_info]);
if (($_name == “Flu Clinic”) || ($_name == “Diabetes Clinic”)) {
$event_info = “$_name coming to this store on $_date”;
} elseif ($_name == “Baltimore Health & Beauty Expo”) {
$event_info = “Visit the $_name May 9 & 10 at the Baltimore Convention Center.”;
} elseif ($_name == “Six Flags Magic Mountain Season Passes”) {
$event_info = “Purchase your $_name for a special price of only $54.99 at this Rite Aid location now through May 2nd.”;
}
if (($_start_time > 0) && ($_end_time > 0)) {
if (($_name != “”) && ($_name != “Baltimore Health & Beauty Expo”) && ($_name != “Six Flags Magic Mountain Season Passes”)) {
$event_info .= ” from $_start_time to $_end_time.”;
} else {
$event_info .= “From $_start_time to $_end_time.”;
}
}
if (strlen($_additional_info) > 0 ) {
$_additional_info = str_replace(“<event_start_date>”, $_date, $_additional_info);
$_additional_info = str_replace(“<event_end_date>”, $_end_date, $_additional_info);
$_additional_info = str_replace(“<event_start_time>”, $_start_time, $_additional_info);
$_additional_info = str_replace(“<event_end_time>”, $_end_time, $_additional_info);
$event_info .= ” $_additional_info “;
}
if (strlen($_url) > 0 ) {
if (substr($_url,0,7) == “http://”) {
$event_info .= ” Click <a href=” . log_and_redirect($_url) . ” target=’new’>here</a> for more info. “;
} else {
$event_info .= ” Click <a href=’$_url’>here</a> for more info. “;
}
}
print (”
<tr><td colspan=5 width=100% bgcolor=’#f5f5f5′ valign=’middle’ align=’left’><table width=100% cellpadding=0 cellspacing=0 border=0><tr><td valign=top>
<img src=’/layout/search_icon_general.gif’ width=’19’ height=’19’ border=’0′ align=’left’></td><td valsign=top>
<font color=’#666666′> $event_info </font></td></tr></table>
</td></tr>
“);
}
?>
Thanks!!!