Jump to content

Archived

This topic is now archived and is closed to further replies.

akisok2

Help with PHP Event lister

Recommended Posts

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!

<?php
include '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);
}
}


?>

Share this post


Link to post
Share on other sites
[code]
<?php
include '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.

Share this post


Link to post
Share on other sites
Unfortunately, the solution you suggested does not work. And I have yet to hear back from the author. Anybody else?

Share this post


Link to post
Share on other sites
[code]
<?php
include '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]
<?php
include '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]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.