Jump to content

php2010

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Everything posted by php2010

  1. I've been digging and I found this. Really wish I understood GIS a little more. :-\
  2. Sounds interesting. If you come up with anything let me know. I appreciate all the help. I'm gonna try some more stuff after work today.
  3. I don't really know what you would call it. Something like how GIS software ""dissolves"" boundaries together. Merging all polygons to form one and eliminate any spaces. Seems very difficult.
  4. Well I've read plenty on this topic but I haven't found something that's really ""stuck out"" to me. Stuff like this and so forth.
  5. What I'm looking to do is analyze an array of coordinates and generate a convex-hull type outline of all independent polygons merged. Convex hull isn't ideal for my situation as I need the outline detailed. From: To: This is how the data is arranged (The keys are just for reference): $array['Group_01']['Polygon_01'] = array('latitude, longitude', 'latitude, longitude', 'latitude, longitude', etc.); $array['Group_01']['Polygon_02'] = array('latitude, longitude', 'latitude, longitude', 'latitude, longitude', etc.); $array['Group_01']['Polygon_03'] = array('latitude, longitude', 'latitude, longitude', 'latitude, longitude', etc.); $array['Group_02']['Polygon_01'] = array('latitude, longitude', 'latitude, longitude', 'latitude, longitude', etc.); $array['Group_02']['Polygon_02'] = array('latitude, longitude', 'latitude, longitude', 'latitude, longitude', etc.); etc. Basically in that scenario I would like to join ALL of the coordinates to form an outline in both 'Group_01' and 'Group_02' based on the polygons in 'Polygon_xx' under that group. Each outline independent of itself. So 'Group_01' would be a union of $array['Group_01']['Polygon_01'], $array['Group_01']['Polygon_02'], and $array['Group_01']['Polygon_03']. Then 'Group_02' would be a union of $array['Group_02']['Polygon_01'] and $array['Group_02']['Polygon_02']. This would output an array of something like $array['Group_01']['Unified'] and $array['Group_02']['Unified'] etc. Is this possible? Any help would be greatly appreciated. Thanks.
  6. I found the solution. This can be removed.
  7. I'm having a bit of trouble converting dates from strings. "171630Z - 181200Z" is what I would like to convert. I want to be able to display more information via date() with strtotime(). The timezone I would prefer is Central. To explain what the string represents: 17 = day (December 17th - today) 1630Z = time in UTC/GMT 18 = day (December 18th - tomorrow) 1200Z = time in UTC/GMT Is there an easy way of doing this or is it impossible with just the day and time in UTC? Thanks. Edit: I would also like to convert "1009 AM CST FRI DEC 17 2010" but that isn't working either. :-\
  8. I've been reading as much as I can but I can't seem to figure this out. I'm confused by arrays, exploding, and organizing the data. && LAT...LON 4151 7448 4160 7438 4164 7427 4161 7424 4159 7414 4162 7413 4162 7410 4159 7405 4159 7396 4145 7399 4149 7393 4150 7385 4121 7385 4103 7450 4108 7451 4119 7438 4135 7471 4140 7475 4150 7475 TIME...MOT...LOC 0838Z 236DEG 47KT 4159 7465 4137 7463 4098 7497 $$ The data I would like to get is between: 'LAT...LON' and 'TIME...MOT'. Is the best way of doing this like below?: preg_match_all('/LAT...LON (.*)\nTIME...MOT/Uism',$data,$results); $SVR = $results[1]; The problem I'm having, I want to explode all of those numbers and convert them over to LAT/LON (xx.xx, -yy.yy) and echo the first lat/lon at the end to complete the "line". While also keeping EACH section separate to it's own line and echo them out like this: Color: 000 000 255 Line: 6,0,"blah" 41.51, -74.48 41.60, -74.38 41.64, -74.27 41.61, -74.24 41.59, -74.14 41.62, -74.13 41.62, -74.10 41.59, -74.05 41.59, -73.96 41.45, -73.99 41.49, -73.93 41.51, -74.48 End: Color: 000 000 255 Line: 6,0,"blah" SECOND SET OF LAT/LON HERE End: Color: 000 000 255 Line: 6,0,"blah" THIRD SET OF LAT/LON HERE End: So on and so forth. After I figure out how to keep everything separate I should be able to figure it out. I'm having some real trouble with the arrays. Here's the current file I've figured out so far: $file = fopen('svr.txt','r'); while($t = fread($file,102465)){ $data .= $t; } fclose($file); preg_match_all('/LAT...LON (.*)\nTIME...MOT/Uism',$data,$results); $SVR = $results[1]; $SVR = preg_replace('/\n/', ' ', $SVR); $SVR = preg_replace('/\s\s+/', ' ', $SVR); unset($data); header("Content-Type: text/plain"); $svrlatlon = array_unique($SVR); $svrwarning1 = $svrlatlon[0]; $svrwarning1 = explode(" ", $svrwarning1); $svrwarning1count = count($svrwarning1); $svrwarning2 = $svrlatlon[1]; $svrwarning2 = explode(" ", $svrwarning2); $svrwarning2count = count($svrwarning2); $svrwarning3 = $svrlatlon[2]; $svrwarning3 = explode(" ", $svrwarning3); $svrwarning3count = count($svrwarning3); $svrwarning4 = $svrlatlon[3]; $svrwarning4 = explode(" ", $svrwarning4); $svrwarning4count = count($svrwarning4); echo "Severe Thunderstorm 1 Lat Lon:\n"; for ($i = 0; $i < $svrwarning1count; $i+= 2) { if ($svrwarning1[$i+1] != null) { echo substr($svrwarning1[$i], -4, 2) . "." . substr($svrwarning1[$i], -2, 2) . ", -" . substr($svrwarning1[$i+1], -4, 2) . "." . substr($svrwarning1[$i+1], -2, 2) . "\n"; } } if ($svrwarning1[0] != null){ echo substr($svrwarning1[0], -4, 2) . "." . substr($svrwarning1[0], -2, 2) . ", -" . substr($svrwarning1[1], -4, 2) . "." . substr($svrwarning1[1], -2, 2) . "\n\n\n"; } echo "Severe Thunderstorm 2 Lat Lon:\n"; for ($i = 0; $i < $svrwarning2count; $i+= 2) { if ($svrwarning2[$i+1] != null) { echo substr($svrwarning2[$i], -4, 2) . "." . substr($svrwarning2[$i], -2, 2) . ", -" . substr($svrwarning2[$i+1], -4, 2) . "." . substr($svrwarning2[$i+1], -2, 2) . "\n"; } } if ($svrwarning2[0] != null){ echo substr($svrwarning2[0], -4, 2) . "." . substr($svrwarning2[0], -2, 2) . ", -" . substr($svrwarning2[1], -4, 2) . "." . substr($svrwarning2[1], -2, 2) . "\n\n\n"; } echo "Severe Thunderstorm 3 Lat Lon:\n"; for ($i = 0; $i < $svrwarning3count; $i+= 2) { if ($svrwarning3[$i+1] != null) { echo substr($svrwarning3[$i], -4, 2) . "." . substr($svrwarning3[$i], -2, 2) . ", -" . substr($svrwarning3[$i+1], -4, 2) . "." . substr($svrwarning3[$i+1], -2, 2) . "\n"; } } if ($svrwarning3[0] != null){ echo substr($svrwarning3[0], -4, 2) . "." . substr($svrwarning3[0], -2, 2) . ", -" . substr($svrwarning3[1], -4, 2) . "." . substr($svrwarning3[1], -2, 2) . "\n\n\n"; } echo "Severe Thunderstorm 4 Lat Lon:\n"; for ($i = 0; $i < $svrwarning4count; $i+= 2) { if ($svrwarning4[$i+1] != null) { echo substr($svrwarning4[$i], -4, 2) . "." . substr($svrwarning4[$i], -2, 2) . ", -" . substr($svrwarning4[$i+1], -4, 2) . "." . substr($svrwarning4[$i+1], -2, 2) . "\n"; } } if ($svrwarning4[0] != null){ echo substr($svrwarning4[0], -4, 2) . "." . substr($svrwarning4[0], -2, 2) . ", -" . substr($svrwarning4[1], -4, 2) . "." . substr($svrwarning4[1], -2, 2) . "\n\n\n"; } If anyone knows how to do this, can you explain it or add comment sections to the code so I can better understand how to achieve this? Thanks.
  9. I got a buddy of mine to recode some things and this is finished.
  10. I have the code for the odd/even but the problem is, it takes the answer from the FIRST STNRY points (for $difference) and uses that same value for the second and so on. So when the first STNRY line is even, it says that the second line is even as well which is not a desirable output. if ($explodedstnry_length & 1) {$difference = 1;} if ($explodedstnry_length & 0) {$difference = 2;} That is the code I'm using before echoing the Line statements. :-\
  11. Alright it looks like I only have one more problem left with this. I need to be able to count how many lat lon points there are for EACH STNRY and make $difference = 2 if it's odd and $difference = 1 if it's even that way I can use $difference to subtract from $explodedstnry_length so it outputs the exact amount of lines I need. Like this: for ($i = 1; $i < $explodedstnry_length - $difference; $i+= 2) { if ($lonstnry[$i+2] != null){ echo "Color: 255 000 000\nLine: 6,0,\"Stationary Front at ".$timect."\"\n"; echo ($latstnry[$i]/10) . ', -' . ($lonstnry[$i]/10) . "\n"; echo ($latstnry[$i+1]/10) . ', -' . ($lonstnry[$i+1]/10) . "\n"; echo "End:\n"; echo "Color: 000 000 255\nLine: 6,0,\"Stationary Front at ".$timect."\"\n"; echo ($latstnry[$i+1]/10) . ', -' . ($lonstnry[$i+1]/10) . "\n"; echo ($latstnry[$i+2]/10) . ', -' . ($lonstnry[$i+2]/10) . "\n"; echo "End:\n";} Is this possible? Edit I didn't notice you had replied sorry. I haven't had any experience at all with functions but I will take it into consideration and play with it a bit. Edit 2: I just tried to run the functions and I get this: <b>Fatal error</b>: Cannot redeclare format_latlong() (previously declared in fronts_fuctions.php:59) in <b>fronts_fuctions.php</b> on line <b>59</b><br />
  12. Ignore this post I just figured it out. I tried to edit but I was too late.
  13. I just ran a test run with the "if ($cur_line !== null) $lines_arr[] = $cur_line;" line added to the bottom and it's still not showing the last stationary line.
  14. I've placed this code at the end and no errors have been reported. I will post back if anything else goes wrong. Thanks a bunch! Thanks for this code! I will def play around with this. What I'm currently doing is this: if (strpos($line, "HIGHS") === 0) { $line = chop($line); $explodedhp = explode(" ", $line); $explodedhp_length = count($explodedhp); for ($i = 1; $i < $explodedhp_length; $i += 2) { $lathp[$i] = substr($explodedhp[$i+1], -7, 3); $lonhp[$i] = substr($explodedhp[$i+1], -4, 4); $lathp2[$i] = substr($explodedhp[$i+1], -7, 3) - 1.5; $lonhp2[$i] = substr($explodedhp[$i+1], -4, 4); echo "Object: ".($lathp[$i]/10).", -".($lonhp[$i]/10)."\nThreshold:999\nColor: 255 100 000\n"; echo "Icon: 0,0, 0, 2, 1, ",$explodedhp[$i]."MB\n"; echo "Text: 0, -30, 1, \"".$explodedhp[$i]."MB\"\nEnd:\n\n"; }echo "\n\n"; } The same basically for Lows except with a different color, etc. The only other somewhat weird problem I'm having is alternating the colors of the stationary front lines. What I would like to do is like have this: lat1,lon1 to lat2,lon2 - RED LINE lat2,lon2 to lat3,lon3 - BLUE LINE On and on until it reaches no more lat lon points. So 4 lat points would make: --- --- --- and an output of something like: Color: 255 000 000 Line: 6,0,"Stationary Front at 9 PM" 31.1, -87.1 30.4, -88.2 End: Color: 000 000 255 Line: 6,0,"Stationary Front at 9 PM" 30.4, -88.2 30.1, -88.9 End: Color: 255 000 000 Line: 6,0,"Stationary Front at 9 PM" 31.1, -87.1 30.4, -88.2 End: I'm currently achieving this but with a few errors below: if (strpos($line, "STNRY") === 0) { $line = chop($line); $explodedstnry = explode(" ", $line); $explodedstnry_length = count($explodedstnry); for ($i = 1; $i < $explodedstnry_length; $i++) { $latstnry[$i] = substr($explodedstnry[$i], -7, 3); $lonstnry[$i] = substr($explodedstnry[$i], -4, 4);} if ($explodedstnry % 2 == 1) {for ($i = 1; $i < $explodedstnry_length - 1; $i+= 2) { if ($lonstnry[$i+2] != null){ echo "Color: 255 000 000\nLine: 6,0,\"Stationary Front at ".$timect."\"\n"; echo ($latstnry[$i]/10) . ', -' . ($lonstnry[$i]/10) . "\n"; echo ($latstnry[$i+1]/10) . ', -' . ($lonstnry[$i+1]/10) . "\n"; echo "End:\n"; echo "Color: 000 000 255\nLine: 6,0,\"Stationary Front at ".$timect."\"\n"; echo ($latstnry[$i+1]/10) . ', -' . ($lonstnry[$i+1]/10) . "\n"; echo ($latstnry[$i+2]/10) . ', -' . ($lonstnry[$i+2]/10) . "\n"; echo "End:\n";} if ($latstnry[$i+2] == null && $lonstnry[$i+1] != null){ echo "Color: 255 000 000\nLine: 6,0,\"Stationary Front at ".$timect."\"\n"; echo ($latstnry[$i]/10) . ', -' . ($lonstnry[$i]/10) . "\n"; echo ($latstnry[$i+1]/10) . ', -' . ($lonstnry[$i+1]/10) . "\n"; echo "End:\n"; }else{ for ($i = 1; $i < $explodedstnry_length - 2; $i+= 2) { if ($lonstnry[$i+2] != null){ echo "Color: 255 000 000\nLine: 6,0,\"Stationary Front at ".$timect."\"\n"; echo ($latstnry[$i]/10) . ', -' . ($lonstnry[$i]/10) . "\n"; echo ($latstnry[$i+1]/10) . ', -' . ($lonstnry[$i+1]/10) . "\n"; echo "End:\n"; echo "Color: 000 000 255\nLine: 6,0,\"Stationary Front at ".$timect."\"\n"; echo ($latstnry[$i+1]/10) . ', -' . ($lonstnry[$i+1]/10) . "\n"; echo ($latstnry[$i+2]/10) . ', -' . ($lonstnry[$i+2]/10) . "\n"; echo "End:\n";} if ($latstnry[$i+2] == null && $lonstnry[$i+1] != null){ echo "Color: 255 000 000\nLine: 6,0,\"Stationary Front at ".$timect."\"\n"; echo ($latstnry[$i]/10) . ', -' . ($lonstnry[$i]/10) . "\n"; echo ($latstnry[$i+1]/10) . ', -' . ($lonstnry[$i+1]/10) . "\n"; echo "End:\n";}} }} }echo "\n\n"; Every now and then there will be more than 1 stationary front and if it's an odd amount of lat/lon points it will connect the ODD stationary front to the following stationary front. I tried to stop this with an if statement of: if ($explodedstnry % 2 == 1) Basically saying IF ODD then "$explodedstnry_length - 1" ELSE "$explodedstnry_length - 2" which makes sense right? The math of this is kind of confusing for me looking at all this code combined together. I don't know if there's an easier way to achieve what I want to do or not but so far this has been a pain and I have to keep changing it to keep it working.
  15. I ran into a little problem. For some reason it isn't catching the last line of the source. Like right now this is the data: CODED SURFACE FRONTAL POSITIONS NWS HYDROMETEOROLOGICAL PREDICTION CENTER CAMP SPRINGS MD 825 PM EST SAT NOV 13 2010 VALID 111400Z HIGHS 1021 3340813 1022 3840775 1033 4291214 1028 5070752 1022 3350963 LOWS 1004 4450907 1002 6481006 998 6591355 1000 6111579 1016 3531047 984 7300598 987 6590579 994 6070493 1003 5391451 COLD 2950919 2830927 2690940 2580948 2480957 2360963 2280969 2190976 OCFNT 4450907 4470903 4480897 4490889 4470881 4450875 4420869 4380865 4310862 COLD 4310862 4230860 4150859 4040860 3890864 3650874 3340890 3120904 2950917 COLD 5570390 5260437 5040484 4930534 4880553 4780574 4660596 4550615 4450632 4400646 4350662 4320675 4300708 4290724 4300743 4300758 WARM 6471004 6430977 6360941 6290920 6210904 6090890 COLD 6461009 6361021 6261036 6161056 6061083 6001111 5981134 5981156 6011184 6111211 WARM 6581351 6531316 6411275 6301247 6111212 STNRY 6581358 6581389 6531419 6441439 6381463 6361484 6331516 6261548 6161570 6111578 COLD 6081577 5961575 5801578 5581592 TROF 5651150 5511133 5291112 5061099 4851092 4531083 TROF 4151241 3991234 3821225 3641214 3471201 3281183 TROF 4061025 3891029 3691036 3531047 3431059 3361075 3341097 TROF 6580581 6880580 7160588 7420610 7610643 7840636 OCFNT 6070495 5950457 5840429 5690405 5580390 TROF 6110506 6300523 6490544 6590570 TROF 6480589 6040572 5760556 5480538 WARM 5331359 5081315 4801288 COLD 5901588 5901588 WARM 5570390 5380369 5250357 5150351 COLD 5331359 5231356 5111363 5011378 4891400 4801417 4691439 OCFNT 5391450 5431427 5421393 5341360 TROF 6861739 6821697 6721653 6601628 6471610 STNRY 4300759 4270782 4200808 4160820 4170829 4180834 4210838 4260842 4290845 4300850 4300854 4310858 4310861 $$ and it's not pulling and and making the "STNRY" line.
  16. That works just perfect. I'm currently situating all of the data but so far that looks like exactly what I needed. If I run into any problems I will post back. Thanks a ton
  17. Thanks! That separates the HIGHS and LOWS but how would i convert the lat/lon to the format I need? from: 5121174 to 51.2, -117.4 4120673 to 41.2, -67.3 etc. I'm going to play around with this code to try to figure out the COLD, WARM, OCFNT, etc. to see if I understand this any. Edit: I just noticed a problem. The HIGHS and LOWS have line breaks in them: HIGHS 1022 4120673 1028 6431205 1037 5121174 1022 7090423 1038 4801098 1030 7571450 1022 3471278 1034 4051133 After 1030 so it calls the MB but doesnt pick up the 7571450 latlon and everything after it. :-\
  18. I got it to finally explode the data with what you posted btherl but the output was kinda strange: MD: CODED LATLON: SURFACE MD: FRONTAL LATLON: POSITIONS NWS MD: HYDROMETEOROLOGICAL LATLON: PREDICTION MD: CENTER LATLON: CAMP MD: SPRINGS LATLON: MD 626 MD: PM LATLON: EDT MD: WED LATLON: NOV MD: 03 LATLON: 2010 MD: VALID LATLON: 110321Z HIGHS MD: 1022 LATLON: 4120673 MD: 1028 LATLON: 6431205 MD: 1037 LATLON: 5121174 MD: 1022 LATLON: 7090423 MD: 1038 LATLON: 4801098 MD: 1030 7571450 LATLON: 1022 MD: 3471278 LATLON: 1034 MD: 4051133 LATLON: LOWS MD: 993 LATLON: 5320344 MD: 966 LATLON: 5391454 MD: 997 LATLON: 6230330 MD: 999 LATLON: 5240802 MD: 1010 LATLON: 3420760 MD: 983 LATLON: 6500819 1005 MD: 4610855 LATLON: 1006 MD: 2940904 LATLON: OCFNT MD: 2940905 LATLON: 2960901 MD: 2980896 LATLON: 2990888 MD: STNRY LATLON: 3420761 MD: 3320775 LATLON: 3250786 MD: 3120797 LATLON: 3060803 MD: 2990809 LATLON: 2960827 MD: 2960845 LATLON: 2980865 3000875 MD: WARM LATLON: 2990890 MD: 3000884 LATLON: 3000874 MD: COLD LATLON: 2990889 MD: 2920886 LATLON: 2860886 MD: 2740887 LATLON: 2550890 MD: 2300898 LATLON: 2050915 MD: 1900925 LATLON: 1790928 MD: TROF LATLON: 3370890 MD: 3230894 LATLON: 3150899 MD: 3030905 LATLON: 2960905 MD: OCFNT LATLON: 5350359 MD: 5450351 LATLON: 5510329 MD: 5500297 LATLON: 5430258 MD: OCFNT LATLON: 5381446 MD: 5311448 LATLON: 5301459 MD: 5351468 LATLON: 5441476 MD: 5551479 LATLON: 5631473 MD: 5681464 LATLON: WARM MD: 5681463 LATLON: 5741440 MD: 5751407 LATLON: 5641362 MD: COLD LATLON: 5681464 MD: 5651448 LATLON: 5571426 MD: 5411395 LATLON: 5101369 MD: 4621361 LATLON: 4181372 MD: 3911400 LATLON: WARM MD: 5240803 LATLON: 5260801 MD: 5300797 LATLON: WARM MD: 3420760 LATLON: 3370753 MD: 3220744 LATLON: 3110732 MD: COLD LATLON: 6310816 MD: 6070824 LATLON: 5710847 MD: 5390887 LATLON: 5260940 MD: 5331010 LATLON: 5471037 MD: 5701058 LATLON: STNRY MD: 5691057 LATLON: 5791069 MD: 5931103 LATLON: 6061141 MD: 6101175 LATLON: 6101228 MD: 6211269 LATLON: 6261311 MD: 6171372 LATLON: OCFNT MD: 6480822 LATLON: 6540806 MD: 6550778 LATLON: 6500744 MD: 6400726 LATLON: 6320724 MD: COLD LATLON: 6320724 MD: 6190730 LATLON: 6010743 MD: 5650771 LATLON: 5470785 MD: 5300798 LATLON: WARM MD: 6330724 LATLON: 6200704 MD: 5830682 LATLON: COLD MD: 5240803 LATLON: 5090814 MD: 4840835 LATLON: 4740842 MD: 4660850 LATLON: WARM MD: 4600857 LATLON: 4630853 MD: 4670849 LATLON: TROF MD: 5400425 LATLON: 5190425 MD: 5030426 LATLON: COLD MD: 4590856 LATLON: 4510867 MD: 4390888 LATLON: 4330920 MD: TROF LATLON: 4490863 MD: 4290871 LATLON: 4110884 MD: TROF LATLON: 4280784 MD: 4190795 LATLON: 4140809 MD: 4080821 LATLON: 4050830 MD: 3980846 LATLON: 3870859 MD: 3780871 LATLON: TROF MD: 6190558 LATLON: 5990522 MD: 5680487 LATLON: 5520465 MD: 5480454 LATLON: TROF MD: 6790829 LATLON: 7110827 MD: 7470810 LATLON: 7810750 MD: TROF LATLON: 4511195 MD: 4621185 LATLON: 4751161 MD: 4831138 LATLON: TROF MD: 5891623 LATLON: 6091652 MD: 6331660 LATLON: 6571662 MD: 6781674 LATLON: 6961718 MD: LATLON: $$ Something is wrong here.
  19. Thanks. This may seem like a silly question, but how would I call this remote file? I'm currently using fopen and a dummy file I just made with the content I posted in the original post titled "fff.txt". I'm not sure how to setup the variables to link it together to read the data. Should it be something like: $file = fopen('fff.txt','r'); while($content = fread($file,102465)){ $line .= $content; } fclose($file); ? I'm relatively new to exploding data and calling external files.
  20. Thanks for your response. Unfortunately I'm not sure if the amount of MD and LAT/LON points are static. Hopefully they are. I will play around with this coding now thanks. Do you have any idea how to do the others? (cold, warm, ocfnt, trof etc.) As those values fluctuate a bunch. :-\
  21. What I'm basically doing is grabbing data from a source and I want to display it in a different way. A preview of the original data is below: CODED SURFACE FRONTAL POSITIONS NWS HYDROMETEOROLOGICAL PREDICTION CENTER CAMP SPRINGS MD 626 PM EDT WED NOV 03 2010 VALID 110321Z HIGHS 1022 4120673 1028 6431205 1037 5121174 1022 7090423 1038 4801098 1030 7571450 1022 3471278 1034 4051133 LOWS 993 5320344 966 5391454 997 6230330 999 5240802 1010 3420760 983 6500819 1005 4610855 1006 2940904 OCFNT 2940905 2960901 2980896 2990888 STNRY 3420761 3320775 3250786 3120797 3060803 2990809 2960827 2960845 2980865 3000875 WARM 2990890 3000884 3000874 COLD 2990889 2920886 2860886 2740887 2550890 2300898 2050915 1900925 1790928 TROF 3370890 3230894 3150899 3030905 2960905 OCFNT 5350359 5450351 5510329 5500297 5430258 OCFNT 5381446 5311448 5301459 5351468 5441476 5551479 5631473 5681464 WARM 5681463 5741440 5751407 5641362 COLD 5681464 5651448 5571426 5411395 5101369 4621361 4181372 3911400 WARM 5240803 5260801 5300797 WARM 3420760 3370753 3220744 3110732 COLD 6310816 6070824 5710847 5390887 5260940 5331010 5471037 5701058 STNRY 5691057 5791069 5931103 6061141 6101175 6101228 6211269 6261311 6171372 OCFNT 6480822 6540806 6550778 6500744 6400726 6320724 COLD 6320724 6190730 6010743 5650771 5470785 5300798 WARM 6330724 6200704 5830682 COLD 5240803 5090814 4840835 4740842 4660850 WARM 4600857 4630853 4670849 TROF 5400425 5190425 5030426 COLD 4590856 4510867 4390888 4330920 TROF 4490863 4290871 4110884 TROF 4280784 4190795 4140809 4080821 4050830 3980846 3870859 3780871 TROF 6190558 5990522 5680487 5520465 5480454 TROF 6790829 7110827 7470810 7810750 TROF 4511195 4621185 4751161 4831138 TROF 5891623 6091652 6331660 6571662 6781674 6961718 $$ I will take a few lines from that and explain what I'd like to do. HIGHS 1022 4120673 1028 6431205 1037 5121174 1022 7090423 1038 4801098 1030 7571450 1022 3471278 1034 4051133 I would like to pull the "1022" (MB) and "4120673" (LAT/LON), then "1028" (MB) and "6431205" (LAT/LON), etc. and display them like this: Icon: 41.2, -67.3,000,1,1,1022 Icon: 64.3, -120.5,000,1,1,1028 Basically: Icon: LAT, LON,000,1,1,MB "LOWS" would be displayed the same way as "HIGHS" above. "WARM", "COLD", "STNRY", "OCFNT", and "TROF" would be displayed differently as you can see the data for these is different. Those would be displayed like this: From: COLD 5681464 5651448 5571426 5411395 5101369 4621361 4181372 3911400 To: Line: 3,0,"Cold Front" 56.8, -146.4 56.5, -144.8 55.7, -142.6 54.1, -139.5 51.0, -136.9 46.2, -136.1 41.8, -137.2 39.1, -140.0 End: For a better understanding of what this data represents you can visit this website. They explain everything nicely. I'm playing around with "explode" at the moment but I'm clueless as the direction to go to achieve all these different things. Any help will be greatly appreciated.
  22. That works. Basically the only thing I needed to change was GROUP BY user. Thanks a ton.
  23. There's no reason why anyone would enter the same score twice via the submit form and even if they do, I would go in and delete it manually if I had to. I will try that query you posted in a little bit. I'm in the process of finishing up some stuff for work right now and don't have the time to do it right at this moment. Maybe in an hour or so. I will report back how it works after I enter some fake scores to test it later. Thanks.
  24. I don't know if I explained it correctly. Will the above queries work like this? This is what I mean: user1 | score 1 user2 | score 2 user3 | score 3 user4 | score 4 user5 | score 5 user6 | score 6 user7 | score 7 user8 | score 8 user9 | score 9 user10 | score 10 Basically a top ten that excludes multiple scores from the same user. Say user1 submitted 5 scores, I don't want to display all 5 I JUST want to display the highest score from that user and then go on to whoever is second place and so on. Is that possible? Sorry if I explained it wrong I just want to make sure we understand each other before I go tinkering with things. Thanks guys! Edit: Also I would like to mention that I do need the other sections in the table. Like the 'X / User / Score / X / X / X / X / X / X / X / X' All those X's represent other data that I also need that's echoed into an html table.
  25. The only 2 tables relevant to what I want to do are "User" and "Scores." Basically this database holds high scores for a project I've been working on. I only want to display 10 scores, all from different users. No 2 or more scores from the same user. This is my db structure within phpmyadmin: If possible I'd like to run a query where it checks for duplicate entries by the same user and only show the highest score. The current query I'm running is below: $result = mysql_query("SELECT * FROM table ORDER BY Score DESC LIMIT 0, 10"); Is this possible? I can only seem to find information regarding the INSERT IGNORE clause and that obviously won't help me as the users and scores are already in the database. Thanks.
×
×
  • 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.