Justafriend Posted May 1, 2013 Share Posted May 1, 2013 Ok I am just looking at where to start this what I am trying to do is take from text below always formatted same way and pull the date 1st place 1st place email 2nd place 2nd place email 3rd place 3rd place email sometimes there is 2 of them and then pull each of the players points and put them all into tables in mysql in MySQL table I will have 3 tables 1st one is email list headings id, playername,email 2nd one is points headings playername points date and 3rd one Tourneyofchampions headings playername email(which if blank will pull from email table, if filled will update email table) date below is an example of the input what im looking for is a place to start if you have any clarifications I will be happy to answer them Nojoks's Tourney Bracket Tool Version 1.2.1.84Tournament: DeepBlueSeaDate: 04/20/2013Day: SaturdayScheduled Start: 1:00Actual Start: 4:00:02 PMClosed: 4:11:43 PMHost: justme67 (UBG_shorty)Number of Players: 19 1st place: DESERTWARRIOR1st place email: email@address.com2nd place: poetree2nd place email: email@address.com3rd place: TM7_crazykarma3rd place email: email@address.com START POINTSDBS_Arielle 1heli_guy2 1keithsgame 1MiaBela 1PAL_USA_14KT 1pirat3 1TM7_sundgo 1UBG_Angel_D_8 1ziko_14 1_BOMBER_ 3_Antoinette_ 4mawdryn65 4olddanny1 4The_Romano 4ADG_Ronycezar 7onaroll 7TM7_crazykarma 19poetree 32DESERTWARRIOR 45UBG_shorty 10STOP POINTS PLAYER STATISTICS (can be imported into Excel):Name, Wins, Losses, Byes, Boots, Booted, DQedMiaBela, 0, 1, 0, 0, Y, NUBG_Angel_D_8, 0, 1, 0, 0, N, NTM7_crazykarma, 2, 1, 1, 0, N, Nmawdryn65, 1, 1, 0, 0, N, NDESERTWARRIOR, 5, 0, 0, 0, N, Npirat3, 0, 1, 0, 0, N, N_Antoinette_, 1, 1, 0, 0, N, Nheli_guy2, 0, 1, 0, 0, N, NTM7_sundgo, 0, 1, 0, 0, N, Nolddanny1, 1, 1, 0, 0, N, NADG_Ronycezar, 2, 1, 0, 0, N, Nziko_14, 0, 1, 0, 0, N, NPAL_USA_14KT, 0, 1, 0, 0, N, Nonaroll, 2, 1, 0, 0, N, NThe_Romano, 1, 1, 0, 0, N, NDBS_Arielle, 0, 1, 0, 0, N, Nkeithsgame, 0, 1, 0, 0, N, Npoetree, 3, 1, 1, 0, N, N_BOMBER_, 0, 1, 1, 0, N, N Quote Link to comment Share on other sites More sharing options...
lemmin Posted May 1, 2013 Share Posted May 1, 2013 The place to start would be preg_match(). For example, do parse out the date, you could use this expression: preg_match('/Date:\s+(\d{2}\/\d{2}\/\d{4})/', $input, $matches); $date = $matches[1]; Quote Link to comment Share on other sites More sharing options...
Justafriend Posted May 1, 2013 Author Share Posted May 1, 2013 just to break it down the preg_match('/date:\s+, automatically looks at the file and looks for date: and grabs the info after it the rest is just to verify the format Quote Link to comment Share on other sites More sharing options...
lemmin Posted May 1, 2013 Share Posted May 1, 2013 Right, "Date:" is a literal match, "\s+" looks for one or more whitespace characters, and \d{2} matches two digit characters (the slashes are literal also). Quote Link to comment Share on other sites More sharing options...
Justafriend Posted May 1, 2013 Author Share Posted May 1, 2013 so preg_match('/1st Place:\s+(*)/', would return DESERTWARRIOR using above entry I just want to make sure im on the right track I really do appreciate this Quote Link to comment Share on other sites More sharing options...
lemmin Posted May 1, 2013 Share Posted May 1, 2013 Right. The * won't match new line characters by default, so you should get everything on that line. Here is a good reference: http://www.regular-expressions.info/reference.html Quote Link to comment Share on other sites More sharing options...
Justafriend Posted May 2, 2013 Author Share Posted May 2, 2013 ok so i came up with this code to show 04/20/2013 1:00 DESERTWARRIOR email@address.compoetreeemail@address.comTM7_crazykarmaemail@address.com this is the code NOT TESTED YET <?php $date=preg_match('/Date:\s+(\d{2}\/\d{2}\/\d{4})/'); $time=preg_match('/Scheduled Start:\s+(*)'); $1stplace=preg_match('/1st place:\s+(*)'); $1stplaceemail=preg_match('/1st place email:\s+(*)'); $2ndplace=preg_match('/2nd place:\s+(*)'); $2ndplaceemail=preg_match('/2nd place email:\s+(*)'); $3rdplace=preg_match('/3rd place:\s+(*)'); $3rdplaceemail=preg_match('/3rd place email:\s+(*)'); print ($date); print ($time) print ($1stplace); print ($1stplaceemail); print ($2ndplace); print($2ndplaceemail); print ($3rdplace); print ($3rdplaceemail) ?> now 3 questions 1 how do i distiguish if there is 2 sets of 3rd places so if top section looks like this 1st place: DESERTWARRIOR1st place email: email@address.com2nd place: poetree2nd place email: email@address.com1st place: DESERTWARRIOR1st place email: email@address.com2nd place: poetree2nd place email: email@address.com3rd place: TM7_crazykarma3rd place email: email@address.com 1st place: DESERTWARRIOR1st place email: email@address.com2nd place: poetree2nd place email: email@address.com3rd place: UBG_Shorty3rd place email: email@address.com 2nd question is if using a form to put it into it <input type="text" name="playername"> what do i use in place of player name seeing it is multiple things in it and finally is the code above basically right on what i am trying to do thank you for all your help 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.