What is the best approach for allowing users to determine the order of menu items in a CMS using PHP?

When allowing users to determine the order of menu items in a CMS using PHP, one approach is to store the order of the items in a database table along with the menu items themselves. Users can then update the order by manipulating the order field in the database table. This allows for flexibility in rearranging menu items without the need for complex sorting algorithms.

// Assuming a database table named 'menu_items' with columns 'id', 'item_name', and 'order'
// Retrieve menu items ordered by the 'order' field
$query = "SELECT * FROM menu_items ORDER BY `order`";
$result = mysqli_query($connection, $query);

// Display menu items in the desired order
while($row = mysqli_fetch_assoc($result)) {
    echo $row['item_name'] . "<br>";
}