aaricwon Posted March 5, 2008 Share Posted March 5, 2008 I want to start something similar to this. How does a database like this work? http://combatrec.com/display_athlete.php?fighter_id=5068 How does one go about starting this? Link to comment https://forums.phpfreaks.com/topic/94521-how-does-a-database-like-this-work/ Share on other sites More sharing options...
discomatt Posted March 5, 2008 Share Posted March 5, 2008 Learn MySQL http://dev.mysql.com/doc/refman/5.0/en/tutorial.html Learn PHP http://php.net/tut.php Link to comment https://forums.phpfreaks.com/topic/94521-how-does-a-database-like-this-work/#findComment-484029 Share on other sites More sharing options...
cooldude832 Posted March 5, 2008 Share Posted March 5, 2008 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 https://forums.phpfreaks.com/topic/94521-how-does-a-database-like-this-work/#findComment-484036 Share on other sites More sharing options...
cry of war Posted March 5, 2008 Share Posted March 5, 2008 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 https://forums.phpfreaks.com/topic/94521-how-does-a-database-like-this-work/#findComment-484037 Share on other sites More sharing options...
cooldude832 Posted March 5, 2008 Share Posted March 5, 2008 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 https://forums.phpfreaks.com/topic/94521-how-does-a-database-like-this-work/#findComment-484039 Share on other sites More sharing options...
Agricola Posted March 5, 2008 Share Posted March 5, 2008 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 https://forums.phpfreaks.com/topic/94521-how-does-a-database-like-this-work/#findComment-484057 Share on other sites More sharing options...
aaricwon Posted March 5, 2008 Author Share Posted March 5, 2008 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 https://forums.phpfreaks.com/topic/94521-how-does-a-database-like-this-work/#findComment-484336 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.