Ignore:
Timestamp:
2008/10/24 15:32:09 (15 years ago)
Author:
takegami
Message:

ランク並び替え修正

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2/data/class/helper/SC_Helper_DB.php

    r17507 r17655  
    12021202 
    12031203        $max = $objQuery->max($tableName, "rank", $where); 
    1204  
    1205         // 値の調整(逆順) 
     1204        // 値の調整(逆順) 
    12061205        if($pos > $max) { 
    12071206            $position = 1; 
     
    12111210            $position = $max - $pos + 1; 
    12121211        } 
    1213  
     1212         
    12141213        //入れ替え先の順位が入れ換え元の順位より大きい場合 
    12151214        if( $position > $rank ) $term = "rank - 1"; 
     
    12261225            $sql.= " AND $where"; 
    12271226        } 
    1228  
    1229         if( $position > $rank ) $objQuery->exec( $sql, array( $rank + 1, $position )); 
    1230         if( $position < $rank ) $objQuery->exec( $sql, array( $position, $rank - 1 )); 
    1231  
    1232         // 指定した順位へrankを書き換える。 
     1227        if( $position > $rank ) $objQuery->exec( $sql, array($rank, $position)); 
     1228        if( $position < $rank ) $objQuery->exec( $sql, array($position, $rank)); 
     1229        // 指定した順位へrankを書き換える。 
    12331230        $sql  = "UPDATE $tableName SET rank = ? WHERE $keyIdColumn = ? "; 
    12341231        if($where != "") { 
    12351232            $sql.= " AND $where"; 
    12361233        } 
    1237  
    1238         $objQuery->exec( $sql, array( $position, $keyId ) ); 
     1234        $objQuery->exec( $sql, array( $position, $keyId ) ); 
    12391235        $objQuery->commit(); 
    12401236    } 
Note: See TracChangeset for help on using the changeset viewer.