Justafriend Posted September 8, 2014 Share Posted September 8, 2014 ive been looking around and every tutorial information i get is to show data in two fields linked now my problem is i have a table with multiple fields adnd need to show it in one list to give you an idea of what im talking about Table is like this Winner 2nd place 3rd place 3rd place2 player a player b player c player d player h player f player e player g now what i need to know what to look for is to get it so that the list would be like this Player a player b player c player d player e player f player g player h looking for something to work from any help on what in php i should look for to accomplish this i would be greatly appreciated Quote Link to comment Share on other sites More sharing options...
ginerjm Posted September 8, 2014 Share Posted September 8, 2014 (edited) While it doesn't make sense to me yet (your table structure) I'm guessing that you have two rows of data there and you have absolutely no rhyme or reason for how you want them arranged. That means you will have to hard code them the way you want them. Unless you can show us some more data that one can use to organize these items. Edited September 8, 2014 by ginerjm Quote Link to comment Share on other sites More sharing options...
Justafriend Posted September 8, 2014 Author Share Posted September 8, 2014 (edited) ok heres a screen shot of my table structure and the reason im doing it is 1st 2nd and 3rd place finishers get a tourney of champions invite and have a page where players can see if they qualify so in this example Host Date_Time PlayersCount Winner WinnerEmail SecondPlace SecondEmail ThirdPlace ThirdEmail ThirdPlace2 ThirdEmail2 _Sarge_ (Misfit_Sarge) 9/1/2014 17:30 48 sajoma TM7_Tik Atlfan TM7_CROSS Teams 9/1/2014 17:30 NULL LangueDOC TM7_sundgo hard_space sparkzzzz Teams 9/1/2014 17:30 NULL BRs_BAD_Vera TM7_crazykarma1 CGS__im__da_1 clover310 Teams 9/1/2014 17:30 NULL BRs_ronycezar tm7_mygoodness CGS_PopMuzak Misfit_Storm Venture (Dust) 9/1/2014 4:00 9 mokan40 CGS__im__da_1 Booo _Muts_ (_DJ_Muts_) 9/1/2014 5:00 13 EU_IT_mirejo sajoma TM7_crazykarma1 _Smoke_ (racing_2425) 9/1/2014 7:00 28 PRO_milagros A_Baddboy I_DontPlay mtlaw TheEgg (__Eggy__) 9/1/2014 10:30 18 BikerChick TM7_LOVIN_LIFE_ Rustedfish _Muts_ (_DJ_Muts_) 0000-00-00 00:00:00 12 BigCube Reemo Tiger_Ladybug66 Sweetheart_ (Booo) 9/1/2014 13:30 22 Atlfan ComeDanceWithMe happybear PeRe (__mina) 9/1/2014 15:00 26 J1moyer Rustedfish Atlfan PAL_GR_glikoula PeRe (__mina) 9/1/2014 16:00 12 sajoma DancingDice UBG_Arielle ulysses (dj_lia) 9/2/2014 4:00 11 mokan40 Melyn _Antoinette_ Sweetheart_ (Booo) 9/2/2014 5:00 16 alireza_mis2004 Spring_Chicken UBG_Jansii _Smoke_ (racing_2425) 9/2/2014 7:00 19 Gyzmo Litigolfer xxBIGDAVExx Venture (Dust) 8/31/2014 4:00 13 PhantomMask mokan40 Imagdrider i need toi post to the website automatically this list _Antoinette_ A_Baddboy alireza_mis2004 Atlfan BigCube BikerChick Booo BRs_BAD_Vera BRs_ronycezar CGS__im__da_1 CGS__im__da_1 CGS_PopMuzak clover310 ComeDanceWithMe DancingDice EU_IT_mirejo Gyzmo happybear hard_space I_DontPlay Imagdrider J1moyer LangueDOC Litigolfer Melyn Misfit_Storm mokan40 mtlaw PAL_GR_glikoula PhantomMask PRO_milagros Reemo Rustedfish sajoma sparkzzzz Spring_Chicken Tiger_Ladybug66 TM7_crazykarma1 TM7_CROSS TM7_LOVIN_LIFE_ tm7_mygoodness TM7_sundgo TM7_Tik UBG_Arielle UBG_Jansii xxBIGDAVExx Hope this clarifys Edited September 8, 2014 by Justafriend Quote Link to comment Share on other sites More sharing options...
Barand Posted September 8, 2014 Share Posted September 8, 2014 If you stop using your MySQL DBMS as somewhere to store spreadsheets and normalize your data, using DB tables correctly, then your problem becomes trivial. http://forums.phpfreaks.com/topic/273634-best-way-to-set-up-tables-when-multiple-values/?do=findComment&comment=1408360 Quote Link to comment Share on other sites More sharing options...
Justafriend Posted September 8, 2014 Author Share Posted September 8, 2014 ok heres the long and short of it the reason im using it as it is is i have 3 tables might be able 2 cut to 2 but the way its used is its the master input from one text form which takes a standard text area like Nojoks's Tourney Bracket Tool Version 1.2.1.84Tournament: ********jammin2-3 formatDate: 09/05/2014Day: FridayScheduled Start: 3:00 PM PSTActual Start: 6:08:05 PMClosed: 6:17:48 PMHost: Habs4Stanley (lookingfor25)Number of Players: 91st place: sajoma1st place email: 2nd place: happybear2nd place email: 3rd place: Nomodez3rd place email: START POINTSDancingDice 1real_chainsaw 1TR_INT_JHONNY 1victor54 1nanatravels 4TM7_SassyChick 4Nomodez 11happybear 19sajoma 28lookingfor25 10STOP POINTSplaces the players date and points in one table gives all the top information in the 2nd and 3rd is an email table which takes the information from this 1st place: sajoma1st place email: 2nd place: happybear2nd place email: 3rd place: Nomodez3rd place email: and puts it in an tabole with date email and player name this information is used to update 3 pages email list from email table which i have working great points page the sum of each players points in the given month works great the only one im having an issue with is the email list which is why im here Quote Link to comment Share on other sites More sharing options...
Justafriend Posted September 9, 2014 Author Share Posted September 9, 2014 If you stop using your MySQL DBMS as somewhere to store spreadsheets and normalize your data, using DB tables correctly, then your problem becomes trivial. http://forums.phpfreaks.com/topic/273634-best-way-to-set-up-tables-when-multiple-values/?do=findComment&comment=1408360 i appreciate your input on this matter but please ask before assuming we have about 50 tournamants a week all hosted by different hosts so im useing the dbms amd php to gather information from a form and to automatically update the information with php soo i dont have to quit my job to do this for free to update the webpages each 6 to 7 times a day now i could be wrong and please feel free to correct me if i am but isnt this a job that php and mysql is meant for so that a person can avoid having to manually update their webpage every time new data is submitted and to gather information to organize it in a central location online so multiple people have access to the information if im wrong on that i am sorry but to me that is exactly what php and mysql is for and not just a simple spread sheet Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted September 9, 2014 Share Posted September 9, 2014 You have misunderstood Barand's reply completely. You are storing the data in the database in an inefficient manner. If you set up your tables correctly all you'd need to do is run a simple query like this SELECT name FROM players To get all the names of all the players. But you are storing the data as a spreedsheet. This is not the correct way to store the data in mysql. The Winnners, 2nd place and third place entry details should not be stored in columns. Each player should entered as a separate row in the table. You'd then have a single column which will then denote the players finishing position in the tournament. Then all you'd need to do in order fetch the top 3 players by winning order would be SELECT name FROM tournament ORDER by position DESC LIMIT 3 Quote Link to comment Share on other sites More sharing options...
Justafriend Posted September 9, 2014 Author Share Posted September 9, 2014 i apologize for the misunderstanding barrand ok long story time i know i got ripper oon payinf got the code and that is who set up the structure and i have tried multiple times to rewrite the form the way to make it easier but to pay someone to do it or to commit the time to totally rewriting and learning the code is not worth it really for me as i am starting from scratch trying to learn mysqli but the problem is i need to implement the code in a site way before ill be able to sit down and learn it all so i have been scratching codes together as i can and learning along the way but basically right now the issue is i get a tourney format form that submits this info into 3 tablesNojoks's Tourney Bracket Tool Version 1.2.1.84Tournament: ********jammin2-3 formatDate: 09/05/2014Day: FridayScheduled Start: 3:00 PM PSTActual Start: 6:08:05 PMClosed: 6:17:48 PMHost: Habs4Stanley (lookingfor25)Number of Players: 91st place: sajoma1st place email: 2nd place: happybear2nd place email: 3rd place: Nomodez3rd place email: START POINTSDancingDice 1real_chainsaw 1TR_INT_JHONNY 1victor54 1nanatravels 4TM7_SassyChick 4Nomodez 11happybear 19sajoma 28lookingfor25 10STOP POINTS i highlighted in colours to make it easier to explain and where the data goes Red goes in to the points and tourne report tables Navy Goes into the tourne report and email tables Blue goes into the tourne report table and orange goes in points Table from this i need a few pages which most i have already done scraping code together to understand and learn as i go Email page a list of emails that has ever been used in our tourney group from the email list cause of a similar problem im having as with the toc list the tourne report table puts on a diff page so i copy and paste for the paperwork required the points table totals each players individual points for the month and posts them wich is now working and finally a toc list which i have got working kind of i have it so that it shows in multiple rows but isnt in a single toc list its all over the place with ordering and such i used the code that i got ripped off with to get it semi working but now im at an impass why i was gonna start from scratch that was why i was just asking for a hint on where to look just really frustrated and ready to start from scratch so this code will never be a headache for me once i fully understand mysqli Quote Link to comment Share on other sites More sharing options...
Solution ginerjm Posted September 9, 2014 Solution Share Posted September 9, 2014 Your data is a bunch of gibberish. You are getting good advice on developing a proper RDBMS but you are refusing to see that. Until you put your data in a proper structure you are going to have difficulty doing anything with this. In your first reply you made mention of that you could reduce your # of tables from 3 to 2 perhaps. In fact you should probably be increasing the # of tables in order to make it proper. Every event entrant should be place into a table with his name and personal info (contact, age, sex, etc. and player_id) You can do this with just one occurrence of a player's name regardless of how many tourneys he/she enters. Every event should go into a 2nd table with all the info about that tourney - name, dates, location, etc. and an event_id. Every entry from a participant should go into a third table with a record for that player having his player_id and event_id and the division he is entering (dbls, sgls, over 40, under 15 etc). Depending on how many different divs there are this can be expanded to have a division table with a div_id to link back to this entry record. Now you write a query to get things by selecting data from the appropriate table using an event id or a player id or a division id and join them in your query and order them as you wish. By separating your data into distinct tables/purposes you can then write a query that grabs what you need easily, depending upon your sql knowledge. Doing it the way you are is disaster around the bend. Quote Link to comment Share on other sites More sharing options...
Justafriend Posted September 9, 2014 Author Share Posted September 9, 2014 i do understand that to clarify this is done at an online gaming site not real life and age and such info isnt requiired for that and do understand that it will be difficult the format i posted where everything is coming from is a standard text output from our tourney hosting tool software so taking that bit of software and making a form that goes as far as you are talking about is gonna take me ages to redo now as to age and such that is never used all we have is a player nick and sometimes email address and get about 1000 to 2000 different players a month and there are no division basically its a backgammon tournament where each player enters the room and says in pls we assign them and then at the end ask for their email for their toc invites this is all done on a gaming site not in real life Quote Link to comment Share on other sites More sharing options...
ginerjm Posted September 9, 2014 Share Posted September 9, 2014 I got tired of trying to read your last post - too hard to follow your writing(?) style(?). If you write php the way you write English it's going to be a long painful process for you to do this correctly. You're right - don't spend the time needed to do something the right way. Keep on doing your sloppy way and good luck. I'll be signing off this topic now. Quote Link to comment Share on other sites More sharing options...
Justafriend Posted September 11, 2014 Author Share Posted September 11, 2014 I am sorry was typing with zero sleep and have taken your advise have now got the code putting it into a toc table as well. working well thank you for your help and sorry again about the typing Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.