paddy100
01-21-2010, 02:05 PM
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
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