Hey J.
If you count a script as a superpower, then yes!
<?php
header("Content-Type:text/plain");
// load viewer library
$libraryPath = 'cmsb/lib/viewer_functions.php';
$dirsToCheck = array('C:/wamp/www/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }
$sectionName = 'blog';
$inOrderOf = 'createdDate';
$records = mysql_select($sectionName, "TRUE ORDER BY $inOrderOf DESC");
$orderByCounter = 10;
foreach($records as $record){
echo "Updating record #{$record['num']}\r\n";
mysql_update($sectionName, $record['num'], null, array('dragSortOrder' => $orderByCounter));
$orderByCounter += 10;
}
echo "Script Complete!\r\n";
You'll need to update the sectionName variable with the DB name for the section you want to update, and the inOrderOf variable with the date field you want to order the items in. So the script will collect all of the records from a section in date order, then cycle through them and update each records dragSortOrder with order the records have been retrieved in.
Make sure you do a full backup of your database before running this script.
Cheers,
Greg
Greg Thomas
PHP Programmer - interactivetools.com