Re: php personal project

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Disclaimer: The following may sound condescending (I hope not) but
you said you're a newbie so I'll try to start with the very basics.

For your database tables questions you basically want the tables to
represent real life "things". For example, a player, a team, etc.

So let's make a quick list of things you might want to store information about:
Players (an NFL player)
Teams (a NFL team)
Coaches (a NFL coach)
Fantasy Owners (one of your friends who has a fantasy team)

Now that we have that list we have to decide what information we want
to keep about each.

For example a player will need a name, an age, a salary, possible
other stuff that's unique to him alone. Same for teams, coaches and
fantasy owners.

Now that we have a little information about each we need to decide how
to link everything together. In order to properly link things together
(to keep each database record (or row) unique) we need to give each
record a unique id. An auto-incremented integer serves perfecly. So
we'll have player_id, team_id, coach_id, owner_id.

Teams have many players but players only play on one team. In this
case we have a "one to many" relationship between teams and players.
In this case you want to store the team_id in the player table.

The relationship between fantasy owners and players can be more
complicated however. Depending on the rules you set up owners will
surely have several players but players may be owned by several
owners. Here we have a "many to many" relationship. In this case we
need what's called a "middle table", basically a table whose sole
purpose is to link 2 other tables together. We'll call this table
owners_players and it will only have 2 fields: owner_id and player_id.
So when you want all players on an owner's team you select * from
owners_players where owner_id = x and with each of those results you
look up the player's information from his unique id (though it's
easier to do a join but I don't want to get into table joins right now
that's more complicated).

I've shown the two more complicated types of relationship but there's
still another: one to one. In this case you can put the id of the
linked-to record of the other table in either table, it doesn't
particularly matter, put it where you think it makes most sense.

This should be enough to at least get you started collecting some data.

On 9/21/07, Karl james <karljames@xxxxxxxxxxxxxxx> wrote:
> Team,
>
>
>
> I am in need of some help.
>
> I would love to get some assistance on this.
>
> I need to start creating a database for my website.
>
> This will be for a fantasy football league website.
>
> To store stats on the database for archive purposes,
>
> And be able to pull them out on html reports.
>
>
>
> I want to do something similar to this site here.
>
> http://www.webleaguemanager.com/demo/reports/FantasyStandingsRpt.html
>
>
>
> Please review the reports page on the left.
>
>
>
> I want to do all except for real time scoring.
>
> Do not have the monies to purchase that yet, LOL.
>
>
>
> I will be extracting the data from other sites, like NFL.com and ESPN.com
>
>
>
> I know I need to create the players, members, stats tables.
>
> But, I am not sure how to set them up correctly.
>
> I can send you all a word file if you private message me.
>
> It will show what I am looking for.
>
>
>
> Here is a link on my wish list at the moment.
>
>
>
> http://www.theufl.com/ufl_project.htm
>
>
>
> I want to do all the work. I basically just need a instructor to help me
> along the way
>
> To, the end. I seem to never get any one to help me on this. Maybe, because
> I am
>
> A newbie and not sure what to do or what right questions to ask as well.
>
>
>
> Any help in this ordeal would be greatly appreciated. I have NO TIME TABLE
> on this.
>
> Just, a personal goal of mine for me and my friends.
>
>
>
> Please help me through this! :-)
>
>
>
>
>
>
>
> Karl James
>
> karljames@xxxxxxxxxxxxxxx
>
> www.theufl.com
>
>
>
>
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux