ltwCalendar
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsProjectsltwCalendar

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old June 20th, 2005, 01:46 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
get next events

Hi,
I would like to print next event on my homepage (just title of event)
If there are multiple events, I want to print all of them.
Next events are not necessary today or tomorrow.

Does anybody got an Idee ?

Thanks

Reply With Quote
  #2  
Old June 24th, 2005, 02:04 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: get next events

There is no answer so I've done it myself.
If it can help somebody here is my source code :

<?

require_once('agenda/private/ltw_config.php');

$db_connect = mysql_connect($ltw_config['db_server'],$ltw_config['db_user'],$ltw_config['db_pass']);
$base_selection = mysql_select_db($ltw_config['db_name'],$db_connect);

$query = "SELECT * FROM ltw_eventsv4 WHERE event_date >= CURDATE() ORDER BY event_date";
$req = mysql_query($query);
$res = mysql_num_rows($req);
$firstdate = "";
$event_list = "";
$multi_event = "false";
$date = "";

if ($res == 0)
{ echo "<center><b>Sorry there is no result.</b></center>";}
else
{ while($row = mysql_fetch_array($req))
{
extract($row);

if ($firstdate == "")
{ $multi_event = "false";
$firstdate = $event_date;
$event_list ="<td><b> $name</b><BR>";
if ($location != "") { $event_list .= "Location : $location<BR>";}
if ($description != "") { $event_list .= "Description : $description<BR></td>";}

$date = date("j m Y",strtotime($row['event_date']));
}
else
{
if ($event_date == $firstdate)
{
$multi_event = "true";

$event_list .= "<td><b>$name</b><BR>";
if ($location != "") { $event_list .= "Lieu : $location<BR>";}
if ($description != "") { $event_list .= "Description : $description<BR></td>";}

}
}
}
mysql_free_result($req);
}
if ($multi_event == "true")
{ echo "next events on ";echo $date; echo" :<BR> $event_list";}
else
{ echo "Next event on "; echo $date; echo" :<BR> $event_list";}

?>

Reply With Quote
  #3  
Old November 2nd, 2005, 12:36 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: get next events

Thankyou for posting that snippet it helped me save an awful lot of time, appreciated.

Reply With Quote
Reply

Viewing: Codewalkers ForumsProjectsltwCalendar > get next events


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway