Jump to content


Photo

Help with PHP Event lister


  • Please log in to reply
3 replies to this topic

#1 akisok2

akisok2
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 06 June 2006 - 01:13 AM

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);
}
}


?>

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 06 June 2006 - 01:36 AM

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

?>

should really ask the author ok.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 akisok2

akisok2
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 07 June 2006 - 06:57 AM

Unfortunately, the solution you suggested does not work. And I have yet to hear back from the author. Anybody else?

#4 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 07 June 2006 - 07:13 AM

<?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";
}
?>

or
<?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";
}
?>

Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users