473,893 Members | 1,839 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

League Table

13 New Member
Where do i begin...well

I am attempting to build a league management website that will automatically work out league tables, fixtures and results.

The first problem that i have is this:

To automaticaaly work out the fixtures i plan on having the highest point scorers from the previous month to play against the 2nd highest point scores and 3rd v 4th and so on.

Im not sure how to take the data from my database and input the information into the correct place so that the team names show correctly each week.

Can anybody please help me?

Thanks in advance

Matthew
Jan 18 '08 #1
6 2300
dlite922
1,584 Recognized Expert Top Contributor
Where do i begin...well

I am attempting to build a league management website that will automatically work out league tables, fixtures and results.

The first problem that i have is this:

To automaticaaly work out the fixtures i plan on having the highest point scorers from the previous month to play against the 2nd highest point scores and 3rd v 4th and so on.

Im not sure how to take the data from my database and input the information into the correct place so that the team names show correctly each week.

Can anybody please help me?

Thanks in advance

Matthew
Could you explain more on how the process works more in detail.

Do you have a match schedule of days already?

The team that ranks the lowest will be dropped out?

Say we have 10 teams, how would the first round work? , randomly pair up teams?

Of those 10 we get five teams, and of those we get 2.5 teams?

we're programmers, we don't (atleast i) don't have a clue about how sports work.
Jan 19 '08 #2
ak1dnar
1,584 Recognized Expert Top Contributor
Really I also don't have a idea about the game. but it's better if you can create a diagram first, to identify the flow of the system.
Jan 19 '08 #3
mtgriffiths86
13 New Member
Thanks for the replies...

Firstly there are 3 leagues with say 6 teams in each league.

To work out what teams are playing weekly i want to automatically work it out by how many points they have. For example:

1st vs 2nd
3rd vs 4th
5th vs 6th

The following week will be

1st vs 3rd
2nd vs 5th
3rd vs 6th

and so on like that.

I have to look into the database that i have with the points field, check the who has the most to least then input the teams name (which is in the same database as points) in to a format something like this

_____________ VS _______________ __ where the blanks are filled in automatically.

Hope that description helps a lil more

Thanks again

Matthew
Jan 19 '08 #4
mtgriffiths86
13 New Member
This is what i am currently trying to use.

<?php

//opening the database
$host="localhos t"; // Host name
$username="root "; // Mysql username
$password=""; // Mysql password
$db_name="leagu e_table"; // Database name
$tbl_name="leag ue_2"; // Table name

// Connect to server and select databse.
$link=mysql_con nect("$host", "$username" , "$password" )or die("cannot connect");
mysql_select_db ("$db_name") or die("cannot select DB");

$query="SELECT Team_Name FROM league_2 ORDER BY Points DESC LIMIT 1";
$result=mysql_q uery($query);

if(!mysql_db_qu ery($db_name,$q uery,$link)) die(mysql_error ());

echo $result;

?>

The error that i am getting with this is: Resource id #3
Jan 19 '08 #5
mtgriffiths86
13 New Member
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
Jan 21 '08 #6
dlite922
1,584 Recognized Expert Top Contributor
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_ass oc($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($team Arr[$i] && !empty($teamArr[$i+1]))
{
$displayStr = $teamArr[$i] . " VS " . $teamArr[$i+1];
array_push($pai redTeams,$displ ayStr);
}
}

//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 >= $thirdTeamFromB ottom;

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)
Jan 21 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1733
by: Lynda McEwan | last post by:
I am having difficulty in writing a league program for a family member. I wrote a similar program many years ago in turbo pascal but am at a loss with vb. I will get there in the end but has anyone done something similar which is available on shareware or public domain?
0
1099
by: arthur | last post by:
I was wondering if there was any site with a public domain example of how league tables (such as football/soccer tables) could be maintained using ASP and Access databases. Thanks Arthur Turnbull
2
2800
by: Richard Williamson | last post by:
Hi all, I have a problem designing the tables for a leasgue table calculating database. The current structure is this (irrelavent bits omitted) tabTeam(TeamID, TeamName) ------ tabPlayer(PlayerID, TeamID) --------
3
3860
by: Ram | last post by:
Hi, I am trying to set up a DB for a race series where a riders best 6 of 10 rides count towards a league position. I have a table of Riders ( say 300 ) I want to use a form to select which riders from the Riders Table are taking part and create a new Event Table ( say Round 1 ) max of 120 riders per event.
2
3940
by: edwgib2002 | last post by:
Does anyone have any information related to a scheduling algorithm that can be written in VBA and used in an access database to create balanced team schedules for a league?
3
1902
by: stephenf33 | last post by:
Hi All I was wondering if anyone knew how to or has developed an access database that could record exam scores and then copy information onto another form as a league table, showing the highest results Any help would be greatly appriciated Many Thanks Stephen
2
5679
by: tommurray | last post by:
I’m looking for a little help and guidance on creating a league table from entries in a database, because of other requirements it is not possible to update the entry for the person in the database. So there is going to be multiple rows for the same person I would then like to add up the points for that person. Around ten people will be apart of the league and the total number of rows will be no more than one hundred so I don’t think there will...
2
17944
by: minus | last post by:
public class Test { public static void main (String arg) { // "012345678910" alignment guide String results = {"AR 4 BR 5", "CR 0 DR 1", "AR 10 CR 9", "BR 3 DR 1", "AR 0 DR 2", "BR 2 AR 2",
4
7673
by: minus | last post by:
import java.util.Arrays; import java.util.Collections; public class Test { public static void main (String arg) { // "012345678910" alignment guide String results = { "AR 4 BR 5", "CR 0 DR 1", "AR 10 CR 9",
0
9985
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10839
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10927
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9646
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8022
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5858
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4684
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4280
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3289
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.