function update_order($id, $direction) {
// $pages = array($pageid => $position);
$pages = array(3 => 1, 2 => 2, 1 => 3, 4 => 4, 5 => 5);
// Update order
$current = $pages[$id];
$new = ($direction == 'up') ?开发者_如何学C ($pages[$id]++) : ($pages[$id]--);
$old = '';
}
What is the quickest way to find the previous / next key from $current
so I can add / deduct accordingly?
You could try to use
Previous
Current
Next
精彩评论