I have started a project to take information from a calendar database for my web site. I want it to display the next 2 events in sequental order, and what I have works.
Until the December to January as you can see it always is looking for what is equal to or greater than the date on the site. But if my next event is in January = 1 of 2005 it will never appear larger than December = 12 of 2004.
<?php
$m = date(n);
$d = date(j);
$y = date(Y);
mysql_connect("localhost","username","password");
mysql_select_db("database");
$result = mysql_query("select * from calendar_events where ((year >= $y ) and (mday >= $d ) and (month >= $m )) Limit 2");
$row = mysql_fetch_array($result);
$title=$row["title"];
$event_text=$row["event_text"];
$mday=$row["mday"];
$month=$row["month"];
$year=$row["year"];
$eventid=$row["eventid"];
?>
I am not looking for any one to code anything but a few hints. I am new to this and this took me all day :bemused:
I think I woudl be looking for an
if else statement that changes my search perameters, but not sure if that is even possible.
Any hints would be appreciated.
Josh