Any ideas?????

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

dave_55
Forum Newbie
Posts: 19
Joined: Mon Mar 31, 2008 8:33 am

Any ideas?????

Post by dave_55 »

Hi, I am doing a project and was woundering if anyone knows how best to do this as I haven't a clue......

I am making a website where by sports players can book certain games off if they are not available to play. Then this information along with another table i have created, that has player information within it will email the coach a possible side?

Does anyone know the best way to go about this cos i need help???
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Any ideas?????

Post by aceconcepts »

So you want a player to be able to browse games and be able to book off certain ones?

Next, you want this info to be sent to a coach?

Correct?
dave_55
Forum Newbie
Posts: 19
Joined: Mon Mar 31, 2008 8:33 am

Re: Any ideas?????

Post by dave_55 »

Yep thats correct, have you any ideas????
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Any ideas?????

Post by aceconcepts »

Yeh sure,

What tables do you currently have?
dave_55
Forum Newbie
Posts: 19
Joined: Mon Mar 31, 2008 8:33 am

Re: Any ideas?????

Post by dave_55 »

I currently have a table filled out with all the fixtures (dates, home or away, home team, away team) and i also have a table with the players contact details.

Does this help????
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Any ideas?????

Post by onion2k »

I think Ace meant what database tables you've got so far. What data do you think you'll need to store for this application?
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Any ideas?????

Post by aceconcepts »

yeh i meant what db tables do you have :D
dave_55
Forum Newbie
Posts: 19
Joined: Mon Mar 31, 2008 8:33 am

Re: Any ideas?????

Post by dave_55 »

Well i currently have this info for bringing up my fixtures table. Within my player table i have (position number, first name, last name, house number, house name, street, town, postcode, contact number, other contact number, email address).

Is this th info you looking for im new to php??? Im thinking im goin to have to create another table that stores the dataon the game they cannot play wont I???


<?php
$database = "localhost"; //login to the server
$username = "Dave"; //username login
$password = "*****"; //password login

//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("<br><br>Unable to connect to Lincoln Database");
echo "<br><br>Connected to Lincoln Database<br><br>";

//select a database to work with
$selected = mysql_select_db("lincolnrugby",$dbhandle)
or die("Could not select lincoln rugby");

$result = mysql_query("SELECT * FROM 1stfixtures"); //execute the SQL query and return records

?>
<table>
<tr>
<td>Date</td>
<td>Home/Away Game</td>
<td>Home Team</td>
<td>Away Team</td>
</tr>

<?php
// Loop through all the rows
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
// Display the information
echo " <tr>\n";
echo " <td>".$row['Date']."</td>\n";
echo " <td>".$row['HomeAwayGame']."</td>\n";
echo " <td>".$row['HomeTeam']."</td>\n";
echo " <td>".$row['AwayTeam']."</td>\n";
echo " </tr>\n";
}

//close off the table
echo "</table>\n";

//close the connection
mysql_close($dbhandle);

?>
dave_55
Forum Newbie
Posts: 19
Joined: Mon Mar 31, 2008 8:33 am

Re: Any ideas?????

Post by dave_55 »

There the only tables I have at the moment:

1stfixtures
1stsquad
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Any ideas?????

Post by aceconcepts »

Ok,

You'll need to create the following tables:

1. tblTeam - this will store info about each team (id, name etc...)

2. tblPlayer - this will store info about each player

3. tblCoach - this will store info about the coaches

4. tblTeamPlayer - this will link each player to the team they play for

5. tblTeamCoach - this will link each coach to the team they coach

6. tblFixtures - like you have (the home tam and away team will be the id's of the teams from tblTeam

7. tblPlayerFixtures - this will link each player with each game they want to play or not

Does this make sense?
dave_55
Forum Newbie
Posts: 19
Joined: Mon Mar 31, 2008 8:33 am

Re: Any ideas?????

Post by dave_55 »

Ok i think I do. and from there i will have to then write my code right???
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Any ideas?????

Post by aceconcepts »

Yeh,

I can help if u like. In order to display results from multiple table you will have to use JOINS.

Doing it this way is the most efficient way - its called normalisation.

Do you understand how the tables will be linked?
dave_55
Forum Newbie
Posts: 19
Joined: Mon Mar 31, 2008 8:33 am

Re: Any ideas?????

Post by dave_55 »

If dont mind that would be awesome. Took on a project a little to hard me thinks.

I understand normalisation but unsure how to do it in SQL. Im using wamp server if u have heard of that to which im running everything of.
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Any ideas?????

Post by aceconcepts »

ok, ill be back online a bit later.

Just finishing work.

I will post back soon.
dave_55
Forum Newbie
Posts: 19
Joined: Mon Mar 31, 2008 8:33 am

Re: Any ideas?????

Post by dave_55 »

Ok thanks ill try and get on and create these tables. ill be onlineso i look forward to hearing from you.

cheers
Post Reply