I met such a problem last night, the customer reflects that the sort of our page is not correct, the other party reflects a few times, but we are not found out, look at the SQL commands of the query, completely sorted according to the requirements, how to Will it be correct. The other party watched that we could not solve it, it was very anxious, and sent the error screens that appeared there, so I took the idea of trying to see it, and the data provided by the user into our system, just started lost. Several, the sort is completely normal, then, when I entered a dozen data, I found that the sort is really abnormal. At first glance, there is no problem with our code: # デ デ タ ベ ス から デ デ デ タ 検 す す# @Param $ query # @return $ Recordset (Hash の Pointer), HOI は 0. # db_select_hash と 点 点:: 序 序 序 序 値 値 値 顺 顺 顺 序 顺 顺;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ( $ RSET) {# print "error when select"; #} # Else {# my $ key; # foreach $ key (sort keys% $ rset) {# my $ arrpoint = $$ {$ key}; #print " $ key = $$ arrpoint [0], $$ arrpoint [1] / n "; #} #} Sub DB_SELECT_HASH2 ($) {MY $ query = shift; my% aux; $ query = escapesql ($ query); evAl {MY $ st = $ dbh -> prepare ($ query); $ st-> execute; my @row; my $ ID = 0; while (@row = $ st-> fetchrow_array) {$ AUX {$ ID} = [@Row]; $ ID ;}}; if ($ @) {lg_adddebug ("_ select_hash2:"; $ query, "db.pm"); return 0;} else {return /% aux;}}} $ rows = & db_select_hash2 ( "select ec91.DISP_NO, ec91.CATEG_ID, ec91.CATEG_NAME, ec91.SHOP_CNT from ec91 where $ owner_id = EC91.OWNER_ID order by EC91.DISP_NO ASC, EC91.CATEG_ID ASC"); foreach $ ke Y (sort keys% $ rows) {...} where the db_select_haash2 () function is queried to the database and puts the query results in the order in a Hash table, the Hash table's key is a self-incremeric digital. In the foreach () loop of the external program, automatically follow this key as the order, return all queries records one by one.