Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-21-2010, 02:05 PM   PM User | #1
paddy100
New Coder

 
Join Date: Jan 2010
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
paddy100 is an unknown quantity at this point
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
paddy100 is offline   Reply With Quote
Old 01-21-2010, 02:27 PM   PM User | #2
JAY6390
Regular Coder

 
Join Date: Dec 2009
Location: UK
Posts: 495
Thanks: 0
Thanked 58 Times in 58 Posts
JAY6390 is on a distinguished road
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 :)
JAY6390 is offline   Reply With Quote
Users who have thanked JAY6390 for this post:
paddy100 (01-21-2010)
Old 01-21-2010, 05:34 PM   PM User | #3
paddy100
New Coder

 
Join Date: Jan 2010
Posts: 10
Thanks: 1
Thanked 0 Times in 0 Posts
paddy100 is an unknown quantity at this point
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!
paddy100 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:22 PM.


Advertisement
Log in to turn off these ads.