为什么价值没有正确添加?

This code is in a foreach loop which should handle a large 'checklist' style input. This particular section should store a number in a database which helps re-order the list.

Testing this code in its own standalone file seems to work and shows the desired result, but put into practice it doesn't work.

// Get the number we need for the disp_order
$order_query = $db_connect->query("SELECT disp_order FROM procedure_data WHERE procedure_id = ".$pd_p_id." ORDER BY disp_order DESC LIMIT 1");
$order = $order_query->fetch_array(MYSQLI_ASSOC);

if ($order['disp_order'] == NULL) {
    $calculated_disp_order = 1;
} else {
    $calculated_disp_order = $order['disp_order']+1;
};

// Close this, we don't need it anymore
$order_query->close();

$stmt = $db_connect->prepare("INSERT INTO procedure_data VALUES 
(NULL, ?, ?, ?, ?, ?, ?, NOW())");
$stmt->bind_param("iissss", $pd_p_id, $calculated_disp_order, 
$pd_task, $pd_action_type, $pd_action, $pd_notes);
$stmt->execute();
$stmt->close();

$order['disp_order'] returns the correct value of 11, but should be increased by 1 at $calculated_disp_order = $order['disp_order']+1;. Instead it's keeping its value of 11.

floatval() was needed for the following line:

$calculated_disp_order = floatval($order['disp_order'])+1;