MTGap
November 6th, 2009, 01:03 AM
I'm trying to echo this multidimensional array, but I'm having trouble as to what to actually do:
$CurTimeStamp = time();
$CurDateName = date("l");
echo $CurDateName;
$Email = "";
define('DB_EVENTS', DB_PREFIX.'aw_ec_events');
/*-------------------------------------------------------+
| Upcoming Events Search - Sunday
+--------------------------------------------------------*/
if ($CurDateName=="Thursday") {
$Day7 = "600937";
$CurDate7 = date("Y-m-d",$CurTimeStamp + $Day7);
$CurDate = date("Y-m-d",$CurTimeStamp);
echo $CurDate7;
echo $CurDate;
echo "Sunday";
$result = dbquery("SELECT * FROM ".DB_EVENTS." WHERE ev_start BETWEEN '$CurDate' AND '$CurDate7' ");
if (dbrows($result)) {
echo dbrows($result);
$i = 0;
while($row = mysql_fetch_assoc($result)) {
foreach($row as $column=>$val) {
$arr[$i][$column] = $val;
}
$i++;
}
$Email = "1";
echo "Email";
/*-------------------------------------------------------+
| Creation of Email Message - Sunday
+--------------------------------------------------------*/
$subject = "Upcoming Events This Week";
foreach ($arr['ev_title'] as $key => $data) {
$eventinfo = "<ul>";
$eventinfo .= "<li><a href='http:///infusions/aw_ecal_panel/view_event.php?id=".$arr['event_id'][$key]."'/>$data</a>";
$eventinfo .= " on ".$arr['ev_start'][$key]." from ".$arr['ev_start_time'][$key]." ".$arr['ev_start_ampm'][$key]." </li>";
$eventinfo .= "</ul>";
$message = "<html><table><tr><td><img src='http:///images/calendar.png' /></td><td><h1 style='font-size:125%'>$subject</h1></td></tr>";
$message .= "<tr><td colspan='2'><hr>The following events are taking place this week: <br /><br />$eventinfo</td></tr><tr><td colspan='2'>";
$message .= "<a href='http:///news.php'><img src='http:///images/logo.png' /></a></td></tr></table></html>";
}
}
}
This was written within php-fusion so some functions are used from its maincore. However I'm having trouble with this foreach statement: foreach ($arr['ev_title'] as $key => $data) {
I'm not sure how to do it... any help. The rest of the code does work though.
$CurTimeStamp = time();
$CurDateName = date("l");
echo $CurDateName;
$Email = "";
define('DB_EVENTS', DB_PREFIX.'aw_ec_events');
/*-------------------------------------------------------+
| Upcoming Events Search - Sunday
+--------------------------------------------------------*/
if ($CurDateName=="Thursday") {
$Day7 = "600937";
$CurDate7 = date("Y-m-d",$CurTimeStamp + $Day7);
$CurDate = date("Y-m-d",$CurTimeStamp);
echo $CurDate7;
echo $CurDate;
echo "Sunday";
$result = dbquery("SELECT * FROM ".DB_EVENTS." WHERE ev_start BETWEEN '$CurDate' AND '$CurDate7' ");
if (dbrows($result)) {
echo dbrows($result);
$i = 0;
while($row = mysql_fetch_assoc($result)) {
foreach($row as $column=>$val) {
$arr[$i][$column] = $val;
}
$i++;
}
$Email = "1";
echo "Email";
/*-------------------------------------------------------+
| Creation of Email Message - Sunday
+--------------------------------------------------------*/
$subject = "Upcoming Events This Week";
foreach ($arr['ev_title'] as $key => $data) {
$eventinfo = "<ul>";
$eventinfo .= "<li><a href='http:///infusions/aw_ecal_panel/view_event.php?id=".$arr['event_id'][$key]."'/>$data</a>";
$eventinfo .= " on ".$arr['ev_start'][$key]." from ".$arr['ev_start_time'][$key]." ".$arr['ev_start_ampm'][$key]." </li>";
$eventinfo .= "</ul>";
$message = "<html><table><tr><td><img src='http:///images/calendar.png' /></td><td><h1 style='font-size:125%'>$subject</h1></td></tr>";
$message .= "<tr><td colspan='2'><hr>The following events are taking place this week: <br /><br />$eventinfo</td></tr><tr><td colspan='2'>";
$message .= "<a href='http:///news.php'><img src='http:///images/logo.png' /></a></td></tr></table></html>";
}
}
}
This was written within php-fusion so some functions are used from its maincore. However I'm having trouble with this foreach statement: foreach ($arr['ev_title'] as $key => $data) {
I'm not sure how to do it... any help. The rest of the code does work though.