Jump to content

tvance929

Members
  • Posts

    18
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.toddvance.com

Profile Information

  • Gender
    Not Telling

tvance929's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I love both of these options!!! Thanks guys!!! I will probably do the sql idea, I should have thought of it and it will be extremely easy. Thanks!
  2. I'm new AND rusty with making arrays but I want to loop through my dbase table and grab the top ten scores, then json that array back to my page. I have all the stuff I need to loop through my table rows. I guess I can take the first one and then start comparing from there. I was planning on having an associative array with userName and avgScore... I have gotten to this point : //First check and see if this row has more than 9 games played. if ($result->fields['gamesPlayed'] > 9) { //Get count of array $theCount = count($scoresArray); //If this is the first row then just add the first score. if ($theCount < 1) { $scoresArray[$result->fields['userName']] = $result->fields['avgScore']; } else if (BLAH BLAH BLHAAHAHAHA) //How to check this -- see if it's above the other. So once I add the first score to the array, I am not sure how to compare the next and then only take the top 10.... Can someone give me some advice or point me to a some? Thanks a bunch! t ---------------- Now playing: The David Crowder Band - O Praise Him (All This For A King) (Oceanic Mix) via FoxyTunes
  3. I want to ajax a database insert to a php page --- if it succeeds I want to refresh my initial page so that the new insert will show up in my datagrid. Can I send something back from my php page that tells my page to refresh???
  4. No that would be a great idea if I could find one. I was surprised to not find any datagrid plugin's made just for wordpress. I am planning on inserting a premade php datagrid into my EXEC-PHP plugin. But ya, it would sure be nice if someone could come up with a wordpress datagrid. I found one (or maybe two) that organize posts and things INSIDE of the admin area but that has nothing to do with what I want. I need real data on the page for viewers, not backend stuff and cannot find one. HAS anyone had any experience with this datagrid http://www.apphp.com/php-datagrid/index.php
  5. Thank you! I did exactly that and found a WP Plugin that processes PHP tags inside of your posts or pages and its working perfect! THANKS! ***FYI - its called EXEC-PHP and the plugins site is here. http://bluesome.net/post/2005/08/18/50/
  6. I am fairly new to php / mysql and have a friend who wants me to create a datagrid of some sort in her wordpress site. I know that wordpress already connects to it's own mysql database to get all it's info, so my question is....can I create a second connection inside of that already existing wordpress php page so I can pull and save her data to her other mysql? IF this is doAble, could someone suggest a datagrid that I could use? I have seen the PHP datagrid page and it looks like more than enough but my big question was if it was even able to connect. Any other thoughts or comments I should know?
  7. Say I add Pvt Bird to the my Array and then try and do the for each I get this in my text file: PFC_bird,634LT._to66ad,33354 CPT_twwwerad,6334 fred, 5454 GENE, 5454 todd, 4343 COL_trerad,3334 SGT_toad,3334 joe, 2343 mike, 33 All the other scores give me the nice line break but the one I added to the array does not... here is more of my code to show you more what Im doing: if ($arrayCount < 10) { //Add new name and score to end $scoresArray[$finalName] = $score; } elseif ($score > end($scoresArray)) { array_pop($scoresArray); $scoresArray[$finalName] = $score; } //Reverse order $result = array_reverse($scoresArray, true); $File = "aa.txt"; $Handle = fopen($File, 'w+'); while(list($Name, $Score)=each($result)) { $newScore = $Name.",".$Score; fwrite($Handle, $newScore); //echo $Name."--".$Score."<br/>"; } fclose($Handle); --------------------------------- Again this all works great except for the one new score that I added to the array -- it prints out but does not give me a new line in my text file......???? *** BTW - I have a confusing convoluted post that I started last night that eventually gets to this point... I wanted to delete that one and add this one. But I cannot figure out how to delete my other post. Thanks so much! t
  8. OK - further clarification... Ive now changed my write method to w+ ... everything is looking good except that the one score that I add to my array doesnt give me the line break. say I add Pvt Bird to the array and then try and do the for each I get this in my text file: PFC_bird,634LT._to66ad,33354 CPT_twwwerad,6334 fred, 5454 GENE, 5454 todd, 4343 COL_trerad,3334 SGT_toad,3334 joe, 2343 mike, 33 All the other scores give me the nice line break but the one I added to the array does not... here is more of my code to show you more what Im doing: if ($arrayCount < 10) { //Add new name and score to end $scoresArray[$finalName] = $score; //asort($scoresArray,SORT_NUMERIC); } elseif ($score > end($scoresArray)) { array_pop($scoresArray); $scoresArray[$finalName] = $score; } //Reverse order $result = array_reverse($scoresArray, true); $File = "aa.txt"; $Handle = fopen($File, 'w+'); while(list($Name, $Score)=each($result)) { $newScore = $Name.",".$Score; fwrite($Handle, $newScore); //echo $Name."--".$Score."<br/>"; } fclose($Handle); --------------------------------- Again this all works great now except for the one new score that I added to the array -- it prints out but does not give me a new line in my text file......????
  9. This is SORT of a problem of the way the data looked to me in notepad... I started opening this in Word and it looked better but it is still doing this one thing: LT._to66ad,33354 fred, 5454 GENE, 5454 todd, 4343 SGT_toad,3334 joe, 2343 mike, 333 **The problem is that the first and second elements are closer than all the others. I want to use this as a way to save high scores but I am afraid when I read this file with it's inconsistencies, it will mess up... any advice???
  10. Im doing this: while(list($Name, $Score)=each($result)) { $newScore = $Name.", ".$Score."\n"; fwrite($Handle, $newScore); } I was hoping to see this in my text file: SGT_todd,12234 Joe,1234 Dude, 1111 Fred,232132 JaNE, 4325 But my fricking text looks like this!?!" Fred,232132 SGT_todd,12234JaNE, 4325 Joe,1234 Dude, 1111 ,,,, Anyone gimme any help???
  11. Sorry to be a bother --- I just found out that I could get the last element of an associative array via the end() function. thats great...the reason I was getting that was because I wanted to see if the incoming number was higher than that last number (I have already sorted)... Now I am stuck on my next step and that is Killing that element if it is lower than the incoming one. my stab was this: elseif ($score > end($scoresArray)) { unset(end($scoresArray)); } but that broke. :'( any help?
  12. Thank you very much!! I also see that I need to call reset() to put the pointer back at the top. **I love this language!
×
×
  • 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.