Changeset 638 for trunk/admin/update.php
- Timestamp:
- Dec 5, 2004, 11:47:46 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/update.php
r633 r638 36 36 // | functions | 37 37 // +-----------------------------------------------------------------------+ 38 39 /**40 * order categories (update categories.rank and global_rank database fields)41 *42 * the purpose of this function is to give a rank for all categories43 * (insides its sub-category), even the newer that have none at te44 * beginning. For this, ordering function selects all categories ordered by45 * rank ASC then name ASC for each uppercat.46 *47 * @returns void48 */49 function ordering()50 {51 $current_rank = 0;52 $current_uppercat = '';53 54 $query = '55 SELECT id, if(id_uppercat is null,\'\',id_uppercat) AS id_uppercat56 FROM '.CATEGORIES_TABLE.'57 ORDER BY id_uppercat,rank,name58 ;';59 $result = pwg_query($query);60 $datas = array();61 while ($row = mysql_fetch_array($result))62 {63 if ($row['id_uppercat'] != $current_uppercat)64 {65 $current_rank = 0;66 $current_uppercat = $row['id_uppercat'];67 }68 $data = array('id' => $row['id'], 'rank' => ++$current_rank);69 array_push($datas, $data);70 }71 72 $fields = array('primary' => array('id'), 'update' => array('rank'));73 mass_updates(CATEGORIES_TABLE, $fields, $datas);74 }75 38 76 39 function insert_local_category($id_uppercat)
Note: See TracChangeset
for help on using the changeset viewer.