Jump to content

How does a database like this work?


aaricwon

Recommended Posts

if you have done any mysql work its probably on single tables.  That  sort of system draws off multiple tables storing various data and then JOINing it together on a single linking key.  If you haven't done any mysql yet I'd suggest you start with some single table things like user login or event storage etc.  and then move on to more complicated table to table relationship.

Link to comment
Share on other sites

probably has 2 tables

 

Table 1 for all user information and Table 2 with all match information

 

Table 1's set up probably something like this

 

ID

Name

and so on

 

 

Table 2's set up

 

ID1

ID2

Result

Time

blah blah blah

 

 

The a query is done something like this

 

Part 1

 

SELECT * FROM 'Table_1' WHERE ID=5068

 

while ($row = mysql_fetch_assoc($result)) {

 

/*FILLED IN THE INFORMATION WITH ARRAY PARTS $row['Name'] */

 

}

 

HERE THE FUNCTION WILL ONLY REPEAT ONCE. BECAUSE THERE IS ONLY ONE ROW OF INFORMATION

 

Part 2

 

SELECT * FROM 'Table_2' WHERE ID1=5068 OR ID2=5068

 

while ($row = mysql_fetch_assoc($result)) {

 

/*FILLED IN THE INFORMATION WITH ARRAY PARTS $row['Name'] */

 

}

 

HERE IT MAY GO ONCE OR A NEAR ENDLESS AMOUNT OF TIME BECAUSE THERE IS MORE THEN ONE ROW WITH THAT ID

 

Link to comment
Share on other sites

done properly the data is JOINed on a key.

 

Table 1

UserID

Username

etc.

 

Table 2

EventId

Player1ID

Player2ID

Date

Time

etc.

 

Select Table2.EventID as eventid, Table2.Date as Date, Table1.Username as PlayerID, from `Table1`,`Table2` where Table2.Player1DI = Table1.UserID orTable2.Player2ID = Table1.UserID Group By Table2.EventID

Link to comment
Share on other sites

the way i would do it is have

 

Table 1- fighter stats

fighter name , id , height weight, age,  etc

 

Table two for all the fight data

Fighter A ID,  fighter B id, result, fight ended id, location ID

 

 

Table 3 will contain fight location data

 

ref ID no,  Venue, address1, addreess 2, address 3

 

Table 4 how fight ended- hold description etc

result id, description.

 

the second table will be main work horse so you need minimal amount of data, you do not want a lengthy identical string stored like 10,000 times  when a single number will suffice

so one table row for table 2 will be somthing like

 

234,1034,2,433,509

 

you simply then pull out a single entry from each using the id number in table 2.

for result if 2= fighter B win 1=A win etc

 

you can then have various ways to search, pull all fights by location, by hold , by fighter etc.

 

Link to comment
Share on other sites

Wow. This is VERY interesting. Unfortunately I don't know how to go about this but just by reading your replies I have learned alot.

 

Would anyone be interested in helping? I don't want someone to do this for me. I would love to have someone guide me through it though so I can actually learn.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.