Click to See Complete Forum and Search --> : Selecting Last Result


zimmo
09-02-2005, 12:26 PM
Hi, Have never had to do this with mysql, but wonder if anyone can help me with a statement.

I need to be able to select a record from the database, the record needs to be the next fixture for a footy match.

Basically no fixtures have been played yet. In my database I have these fields:
1: age_group
2: date
3: home_team
4: away_team
5: home_score
6: away_score

In the database is all the fixtures for our club. I need to load up the next fixture. What is the best way to do this?

Thanks
Barry

WebHours
09-15-2005, 10:29 PM
// run query by date
etc
// loop through query
$nrows = mysql_num_rows($result);
$row = 0;
// loop through records
while( $row < $nrows )
{
$age_group = mysql_result($result,$row,"age_group");
$home_team = mysql_result($result,$row,"home_team");
$away_team = mysql_result($result,$row,"away_team");
etc
$row++;
}
mysql_free_result($result);
mysql_close();

Not sure if this is what you want? If not post more details and I'm sure someone will be able to help

Here is a link to a number of MySQL articles that may also help:
http://www.findingfacts.com/L3/L3_54_55_59.php

sajjad27s
09-16-2005, 01:18 PM
Your question needs some more details for a better solution.