Page 1 of 2

Sort feature

Posted: Wed Aug 22, 2007 22:23
by Worff
I have a strange problem with sorting on Character Statistics page only. On this page only, clicking HP or MANA heading used to sort like it was supposed to, then it just stopped /shrug. All other pages seem to work just fine. Was wondering if you had some pointers on what to look for to be a possible cause.

Thanks :)

Worff

http://www.tribalfury.org/eqroster

Posted: Wed Aug 22, 2007 23:13
by GamePlayHeaven
Hmm... I checked your page and it looks like no sorting is working on the stats page at all.

I first checked your header frame's code. This seems to be working. I click HP and it shows the sortorder as HP, I click it again, and the direction goes to DESC. So the functionality is working, and it's being passed around.

I changed the class filter in the footer, and the sortorder and direction remained like they should. The filter works as well. So this is working as well.

So it must be in the body part, the ShowBody() function.
Above "// Retrieve all the records" I would print out the sql query (strSelectQuery) to see if the order has been set. If not, I would move up in the function to where the order is determine and add some prints here and there to see what it's doing.

Posted: Thu Aug 23, 2007 11:51
by Worff
Cool thanks for the info, that helps narrow down the search and all a lot :) I'll post again when I find what it is.

Posted: Thu Aug 23, 2007 14:29
by Worff
Hmm well I went off all confident I'd find something but I didn't hehe. I looked in the file class.character_statistics.inc .. even uploaded a backup file I had in case something happened to the live one. I didn't really suspect the file class.character_statistics.inc anyway, since it didnt change, just it's behavior.

When you say to Print the query... do you mean the code in the .inc file or the results of a direct query on database? Here is one of the code blocks above "Retrieve all the records"

Code: Select all

      // Retrieve all the maximum overview values of this overview
      $nResult   = mysql_query( $strSelectOverviewMaxQuery, $nLinkID );
      // Store the values
       if( $aResult = mysql_fetch_row( $nResult ) )
      {
         // Retrieve the variables out of the array
         $nIndex                     = 0;
         $this->nOverviewMaxHP         = $aResult[$nIndex++];
         $this->nOverviewMaxMana         = $aResult[$nIndex++];
         $this->nOverviewMaxEndurance   = $aResult[$nIndex++];
         $this->nOverviewMaxAC         = $aResult[$nIndex++];
         $this->nOverviewMaxFT         = $aResult[$nIndex++];
         $this->nOverviewMaxRegen      = $aResult[$nIndex++];
         $this->nOverviewMaxAtk         = $aResult[$nIndex++];
         $this->nOverviewMaxStr         = $aResult[$nIndex++];
         $this->nOverviewMaxSta         = $aResult[$nIndex++];
         $this->nOverviewMaxAgi         = $aResult[$nIndex++];
         $this->nOverviewMaxDex         = $aResult[$nIndex++];
         $this->nOverviewMaxWis         = $aResult[$nIndex++];
         $this->nOverviewMaxInt         = $aResult[$nIndex++];
         $this->nOverviewMaxCha         = $aResult[$nIndex++];
         $this->nOverviewMaxPR         = $aResult[$nIndex++];
         $this->nOverviewMaxMR         = $aResult[$nIndex++];
         $this->nOverviewMaxDR         = $aResult[$nIndex++];
         $this->nOverviewMaxFR         = $aResult[$nIndex++];
         $this->nOverviewMaxCR         = $aResult[$nIndex++];
      }


How would I convert that into an SQL string I could insert into SQL or Query window in phpMyAdmin to see the results? Or is this even what you meant? lol sorry for the trouble.

Posted: Thu Aug 23, 2007 23:17
by GamePlayHeaven
Well, if you didn't change anything in this file, then it should work.
Did you perhaps change one of the form files in the root dir?

The print would look like this:

Code: Select all

      print( $strSelectQuery );
      // Retrieve all the records
      $nResult   = mysql_query( $strSelectQuery, $nLinkID );
      // Show the records one by one


You can also unpack the unmodified roster files to a different dir, and then use a tool like Beyond Compare to compare the 2 directories with one another. The problem has to be in modified code somewhere.

You can always zip up your code and mail it to me, I will do a file compare to see if I can pinpoint where it broke.

Posted: Fri Aug 24, 2007 10:34
by Worff
Hmm I dont think I changed any form files.. the only file I changed was the header, to show a graphic banner. Ok I'll check the form files then try the compare utility.

Thanks again :) I don't want to burden you with this, it is a handy feature to have but at the end of the day it's not a huge crisis, everything else works fine $.

Posted: Fri Aug 24, 2007 11:53
by Worff
Ahh thanks for the Print line... on first open of Character Statistics it reports this:

Code: Select all

SELECT CharName, NameMain, EQPlayersCharID, MageloNr, HP, Mana, Endurance, AC, FlowingThought, Regen, Atk, Str, Sta, Agi, Dex, Wis, `Int`, Cha, PR, MR, DR, FR, CR, OldMember FROM Characters WHERE ( HP > 0 OR Mana > 0 OR Endurance > 0 OR AC > 0 OR FlowingThought > 0 OR Regen > 0 OR Atk > 0 OR Str > 0 OR Sta > 0 OR Agi > 0 OR Dex > 0 OR Wis > 0 OR `Int` > 0 OR Cha > 0 OR PR > 0 OR MR > 0 OR DR > 0 OR FR > 0 OR CR > 0 ) AND ((GuildStatus != 'Alt' AND GuildStatus != 'Inactive') OR NameMain = '') ORDER BY 'CharName' , CharName


After clicking "HP" once it shows this:

Code: Select all

SELECT CharName, NameMain, EQPlayersCharID, MageloNr, HP, Mana, Endurance, AC, FlowingThought, Regen, Atk, Str, Sta, Agi, Dex, Wis, `Int`, Cha, PR, MR, DR, FR, CR, OldMember FROM Characters WHERE ( HP > 0 OR Mana > 0 OR Endurance > 0 OR AC > 0 OR FlowingThought > 0 OR Regen > 0 OR Atk > 0 OR Str > 0 OR Sta > 0 OR Agi > 0 OR Dex > 0 OR Wis > 0 OR `Int` > 0 OR Cha > 0 OR PR > 0 OR MR > 0 OR DR > 0 OR FR > 0 OR CR > 0 ) AND ((GuildStatus != 'Alt' AND GuildStatus != 'Inactive') OR NameMain = '') ORDER BY 'HP' DESC, CharName


Then clicking "HP" again:

Code: Select all

SELECT CharName, NameMain, EQPlayersCharID, MageloNr, HP, Mana, Endurance, AC, FlowingThought, Regen, Atk, Str, Sta, Agi, Dex, Wis, `Int`, Cha, PR, MR, DR, FR, CR, OldMember FROM Characters WHERE ( HP > 0 OR Mana > 0 OR Endurance > 0 OR AC > 0 OR FlowingThought > 0 OR Regen > 0 OR Atk > 0 OR Str > 0 OR Sta > 0 OR Agi > 0 OR Dex > 0 OR Wis > 0 OR `Int` > 0 OR Cha > 0 OR PR > 0 OR MR > 0 OR DR > 0 OR FR > 0 OR CR > 0 ) AND ((GuildStatus != 'Alt' AND GuildStatus != 'Inactive') OR NameMain = '') ORDER BY 'HP' , CharName


So, it seems to be functioning just fine /boggle... but it still doesn't actually change the sort order on the screen.

Posted: Sat Aug 25, 2007 0:25
by GamePlayHeaven
Try booting up phpMyAdmin and repairing the table.
Maybe the table index just got corrupt or something.

Mine too

Posted: Sun Sep 23, 2007 21:46
by Tanliel
I've noted that my installation is no longer sorting on the Statistics page either ... and appears to be doing the exact thing that Worff reports.

I would, of course, be happy to try whatever you might suggest to fix the issue.

I've already gone in and done a repair on the tables, no resolution there.

Posted: Tue Sep 25, 2007 23:48
by GamePlayHeaven
Could you try executing the SQL commands that Worrf posted 2 posts ago in phpMyAdmin and see what they do?

And you might have tried this already to:
In phpMyAdmin, "select all" tables and then "With Selected" click "Optimize table". You can try the analyze as well... you never know what it pops out.

And could you post how many records you have in the table?

Posted: Tue Oct 09, 2007 22:43
by GamePlayHeaven
All I've found so far is that it might be because your server is running out of sort space. But I haven't found any info yet on how/where to check that in the (MySQL) server config.

Still looking into it, but hard to test without the actual problem accessible on any of my rosters.

Not sure if this might help, but you could also do a test where you create an index on the HP field in the table, and then try sorting on HP. If this fixes the problem, then a work around would be to create an index on all the numeric fields in the table. Not elegant, but it might get the job done.

Posted: Sun Oct 28, 2007 19:04
by Tanliel
Optimize: OKs
Analyze : OKs

Total records in all tables : 642

Creating an index on the HP field didn't do anything either.

/shrug

Posted: Mon Oct 29, 2007 0:27
by GamePlayHeaven
Did you also try the SQL query manually in phpMyAdmin?

If you can export the table and mail me the data, I'll take a look at it myself.

Posted: Fri Jan 11, 2008 8:01
by Worff
I'm now thinking the problem lies in the data (from dumps) itself somehow. I say that because I installed 4.2.3 from scratch on a different server, imported the same dump I use on live roster, ran full batch imports of eqplayers data... and the same thing happened only on Char Statistics page.

Upgraded to 4.3.0 (thanks Madbutch!!!!) and it works great as usual except even with the new code the sorting prob on that particular page persists.

Since the code is new I know its not the operating files of eqroster... I guess the web host I use could have ninja'd some SQL settings on all their servers, no clue what to check for tho haha. I have about 700+ chars in the db... is that too many maybe??

Posted: Mon Jan 14, 2008 0:22
by GamePlayHeaven
Could you mail me the dump and possibly a backup of your rosters database?
I can import that locally and perform some tests on it, to see what, why and where :)

Just mail it to eqroster@gameplayheaven.com

How did the upgrade to v4.3.0 go?
Let me know if you notice any odd behavior. With an update like that, there's something bound to break. But so far it's running quite nicely :)