SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Dec 2005
    Posts
    964
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Next upcomming date?!

    I'm trying to make a script where it allways shows the next event from my calendar depending on the date. I have tryid this but it doesnt work... Can somebody see my error?
    PHP Code:
    $username="username";
    $password="password";
    $database="database";

    mysql_connect(localhost,$username,$password);
    @
    mysql_select_db($database) or die( "Unable to select database");
    $query="SELECT TOP 1 calendar_events.*, calendar_events.event_start FROM calendar_events WHERE (((calendar_events.event_start)>=Date())) ORDER BY calendar_events.event_start;";
    $result=mysql_query($query);
    $calendar mysql_fetch_array($result); 

  2. #2
    SitePoint Addict phpster's Avatar
    Join Date
    Feb 2005
    Location
    Toronto, Canada
    Posts
    374
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    TOP 1 is a mssql command, you need limit 1 at the end of the statement for mysql
    phpster

    I wish my computer would do what I want it to.
    Not what I tell it to do...

  3. #3
    SitePoint Guru
    Join Date
    Dec 2005
    Posts
    964
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, but didnt help. I want it to read the next event in db depending on the date now??? Tryid this...

    Code:
    $query="SELECT * calendar_events.*, calendar_events.event_start FROM calendar_events WHERE (((calendar_events.event_start)>=Date())) ORDER BY calendar_events.event_start LIMIT 1";
    Help...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •