akisok2 Posted June 6, 2006 Share Posted June 6, 2006 Hey there. I am using a really cool PHP script written by Erik Kittel (VERY SIMPLE EVENTS LIST VERSION 1.01) and wanted to see if someone could help me with a modification that I'd like to make. I'd like to somehow modifiy this code so that after an event date has passed, the script will echo something like "no new events at this time" or something else. Right now the script just displays the last event until you enter new events. Thanks!<?phpinclude 'config.php';include 'library/opendb.php';include 'library/timeFunctions.php';include 'library/summaryDisplayFunctions.php';$query = "SELECT * FROM events ORDER BY date, time";$result = mysql_query($query);while($row = mysql_fetch_assoc($result)){ if ($row['date'] >= date('Y-m-d')) {displayEvents($row); }} ?> Quote Link to comment https://forums.phpfreaks.com/topic/11286-help-with-php-event-lister/ Share on other sites More sharing options...
redarrow Posted June 6, 2006 Share Posted June 6, 2006 [code]<?phpinclude 'config.php';include 'library/opendb.php';include 'library/timeFunctions.php';include 'library/summaryDisplayFunctions.php';$query = "SELECT * FROM events ORDER BY date, time";$result = mysql_query($query);while($row = mysql_fetch_assoc($result)){ if ($row['date'] >= date('Y-m-d')) {displayEvents($row); }// i added this if it works dont no only learning, else if the $row date is less then the date then display old //messages.} else {if ($row['date'] < date('Y-m-d')) {displayEvents($row); }}?>[/code]should really ask the author ok. Quote Link to comment https://forums.phpfreaks.com/topic/11286-help-with-php-event-lister/#findComment-42254 Share on other sites More sharing options...
akisok2 Posted June 7, 2006 Author Share Posted June 7, 2006 Unfortunately, the solution you suggested does not work. And I have yet to hear back from the author. Anybody else? Quote Link to comment https://forums.phpfreaks.com/topic/11286-help-with-php-event-lister/#findComment-42695 Share on other sites More sharing options...
.josh Posted June 7, 2006 Share Posted June 7, 2006 [code]<?phpinclude 'config.php';include 'library/opendb.php';include 'library/timeFunctions.php';include 'library/summaryDisplayFunctions.php';$currentdate = date('Y-m-d');$query = "SELECT * FROM events where date >= '$currentdate' ORDER BY date, time";$result = mysql_query($query);$num = mysql_num_rows($result);if ($num > 0) { while($row = mysql_fetch_assoc($result)) { displayEvents($row); }} else { echo "there are no events at this time";}?>[/code]or [code]<?phpinclude 'config.php';include 'library/opendb.php';include 'library/timeFunctions.php';include 'library/summaryDisplayFunctions.php';$query = "SELECT * FROM events ORDER BY date, time";$result = mysql_query($query);$count = 0;while($row = mysql_fetch_assoc($result)) { if ($row['date'] >= date('Y-m-d')) { displayEvents($row); $count++; }}if ($count == 0) { echo "there are no events at this time";}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/11286-help-with-php-event-lister/#findComment-42701 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.