How to update the database when reordering list by sortable

Asked

Viewed 243 times

1

Daew guys, I’m using sortable to reorder a list. How do I make the change in the bank within the function? Follow my code:

 <?php
    session_start();
    if ($_SESSION['clienteLogado']=="") {
        header("Location:login.php");
    }
    require_once("function.php");

    $idPesquisa=$_GET['id'];

    $sql = "SELECT * FROM pergunta p WHERE pesq_id=". $idPesquisa . " and perg_exclusao = 1 order by perg_ordem";
    $resultado = $MySQLi->query($sql) OR trigger_error($MySQLi->error, E_USER_ERROR);

?>

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
        <script src="//code.jquery.com/jquery-1.10.2.js"></script>
        <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
        <script>
            $(function() {
            $("#sortable").sortable({
                stop: function(event, ui) {

                 //REORDENAÇÃO

                }
            });
            $( "#sortable" ).disableSelection();
            });

    </script>

Vlw for the help!

  • 1

    I could not understand what the purpose of the question, specify more.

  • Want to sort the fields of a column in alphabetical order and save to the bank?

  • for example: i have a list... id | name | age 1 | john | 22 2 | maria | 18 3 | Joana | 23 .

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.