I have now tried different approaches to this and have come up with a new error which is
Resource 5 error
Does anybody know how to do what i am trying and what these errors are?
Thanks
$result is exactly what you see, a resource.
you must Extract the data from it using one of MySQL builtin function such as mysql_fetch_assoc($result)
which gives you an associate array of the data, then you can loop to output it.
++++++++++++++++++++++++++++++++
as far as the leagues, can one team from one league play another?
Here's what i think should be done from your explanation:
I would query the DB and SORT them in DESCending order, then with a forloop pair them up in such a manner:
[PHP]
$pairedTeams = array();
for ($i = 0; $i < teamArr; $i++)
{
if(!empty($teamArr[$i] && !empty($teamArr[$i+1]))
{
$displayStr = $teamArr[$i] . " VS " . $teamArr[$i+1];
array_push($pairedTeams,$displayStr);
}
}
//then display your output
foreach ($pairedTeams as $pair)
{
echo $pair . "\n";
}
[/PHP]
the above should give you a display of:
1stTeamName VS 2ndBestTeam
3rdBestTeam VS 4thBestTeam
If you want the last 2 teams be dropped out, then you have to put a filter on the DB or the for loop above.
Maybe you query the DB and get the THIRD result when Sorting by score in ASCending order. you take this value and when you do your query you provide the condition WHERE score >= $thirdTeamFromBottom;
That should get rid of the bottom two teams with the lowest scores.
(that is if you don't want them deleted from the database)