troubleshooting Question

how to print list out of each event days from today forward

Avatar of Johnny
JohnnyFlag for United States of America asked on
PHPMySQL Server
20 Comments1 Solution531 ViewsLast Modified:
i have a event listing that works great for today, in that it looks for the start and end fields info and if today falls inside that range it prints it out for todays date. that works wonderfully.
how do i get tomorrow and all the rest of the dates to print out with date as the heading of the section ie

9/2/13 Monday
event title 1
event title 2
event title 6
9/3/13 Tuesday
event title 3
event title 4
event title 12
9/4/13 wed
etc

here is my code so far
<?php
include ('ctx.php');

//
// 
//$result = mysqli_query($con,"select * from iwia_events where event_start < now() and event_end > DATE_ADD(DATE(now()), INTERVAL 11 MONTH)");
//$sql="select * from iwia_events WHERE event_start BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 7 DAY)";
$sql="select * from iwia_events where event_start <= now() and event_end >= now()";
//$sql="select * from iwia_events where event_start < DATE_ADD(CURDATE(), INTERVAL -1 DAY) and event_end > CURDATE()";
//$sql="SELECT * FROM iwia_events WHERE event_start BETWEEN DATE_ADD(CURDATE(), INTERVAL -1 DAY) AND event_end > CURDATE()";

$result = mysqli_query($con,$sql);


if (!$result) {
    echo 'Could not run query: ' . mysql_error();
    exit;
}
echo "<strong style='color:black;'>".date('l jS \of F')."</strong><br>";
while($row = mysqli_fetch_array($result))
  {
  $start_event=date('m-d-Y', strtotime($row['event_start'])); 
  $end_event=date('m-d-Y', strtotime($row['event_end']));     
if ($row['active'] == "1") {
    
  echo '<IMG SRC="'.$row['event_image'].'" ALT="?" BORDER=0 style="width:90px; height:90px;" align="left"></div><br>';
  //echo "Location: ".$row['event_location']."<br>";
  if ($row['event_location']) {
      $loc = "Location: ".$row['event_location']."";
  }
  else {
      $loc="";
  }
  echo " &nbsp;<A HREF='single_event.php?id=".$row['id']."' title=\"".$loc."\">".$row['event_title'] . "</a> <br>";
  
  
  echo "<span style='font-size: 10px; color: gray;'>&nbsp; Start: " . $start_event ." - End: ".$end_event."</span>";
  echo "<p>&nbsp;</p>";
  }
}  
if (!mysqli_num_rows($result)) {
	echo "No Events for today<br>";
}

mysqli_close($con);
?>

note: i tried in the $sql = to do some testing but non worked. and i couldn't figure out how to do the days heading from the search.

Thank you in advance for any code or help you may provide.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 20 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 20 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros