Confirm not being called when using $database->delete from Medoo

Asked

Viewed 38 times

1

I’m using the Medoo framework.

I have a button that calls the function below, and if I leave so the Confirm works normally.

<script>
function RemoveStatus(e) {
    //Pega o elemtno que chamou o evento
    var sender = e.srcElement || e.target;
    //Salva a id do elemento
    var myId = sender.id;
    //Pega apenas o código
    myId = myId.substring(6, 40);

    if (confirm('Confirma a exclusão deste Status?')) {

        <?php

        echo $database->last();

        ?>
    }

}

However, I change by adding $database->delete("status", ["AND" => ["CodStatus" => 4]]); confirm that comes before it stops working.

<script>
    function RemoveStatus(e) {
        //Pega o elemtno que chamou o evento
        var sender = e.srcElement || e.target;
        //Salva a id do elemento
        var myId = sender.id;
        //Pega apenas o código
        myId = myId.substring(6, 40);

        if (confirm('Confirma a exclusão deste Status?')) {

            <?php
            //$database->delete('status', ['CodStatus' => $_GET['myId']]);
            $database->delete("status", ["AND" => ["CodStatus" => 4]]);

            echo $database->last();


            ?>
        }

    }
</script>

If I call the same delete command directly in page creation, for example, the command runs smoothly. What may be happening?

  • What does that show echo $database->last(); in the source code?

  • @Sam shows the last SQL that was executed

  • What do you see in the source code? That’s what I asked :D

  • @Sam I see SQL: Delete From status Where Codstatus IS NULL

No answers

Browser other questions tagged

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