Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2010
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Another challenge I ve set myself

    Hi guys! me again..

    I ve set myself a challenge to create a snippet of code.

    I have a Db with a list of fixtures for the season ( past & future) for both Senior & Academy sides at my club. What I am looking to create is a piece of code that echos the next game that is to take place. I am hazarding a guess that i will need to use the system date to a degree. however it is currently returning the wrong fixture...

    [CODE]

    <html>
    <body>
    <?php

    /* Program to display the next senior game taking place after system date */

    include("rhino.inc");

    $connection = mysql_connect($host, $user, $password)
    or die ("couldn't connect to server");
    $db = mysql_select_db($database, $connection)
    or die ("couldn't connect to database");

    /* select next record from fixturesresults db after the systemdate */
    $query = 'SELECT * FROM `fixturesresults` WHERE `date` >= \'\'\'SYS DATE\'\'\' ORDER BY `date` DESC LIMIT 0, 1';
    $result = mysql_query($query)
    or die ("No Upcoming Games");
    $nrows = mysql_num_rows($result);

    /*display the news text in the banner */
    for ($i=0;$i<$nrows;$i++)
    {
    $n = $i +1; /* add 1 so that numbers dont start with 0 */
    $row = mysql_fetch_array($result);
    extract($row);
    echo "$team <br>";
    echo "V <br>";
    echo "$opposition <br>";
    echo "$ha <br>";
    echo "$date<br>";
    echo "$time";
    }
    ?>
    </body>
    </html>

    [CODE]

    Again I am sure its something simple but any help would be great!

    thanks

  • #2
    Regular Coder
    Join Date
    Dec 2009
    Location
    UK
    Posts
    495
    Thanks
    0
    Thanked 58 Times in 58 Posts
    why exactly do you have \'\'\'SYS DATE\'\'\' in your SQL
    change it to NOW() and see what it does
    My site: JayGilford.com
    Resources:
    PHP Pagination Class | Getting all page links | Handling PHP Errors properly
    If you like a users help, show your appreciation with the rep and thanks buttons :)

  • Users who have thanked JAY6390 for this post:

    paddy100 (01-21-2010)

  • #3
    New Coder
    Join Date
    Jan 2010
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by JAY6390 View Post
    why exactly do you have \'\'\'SYS DATE\'\'\' in your SQL
    change it to NOW() and see what it does
    Thanks Jay!


  •  

    Posting Permissions

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