0

how I can show errors if the insert no works. I try to make an insert in other document. Thanks! Index.php

$("#sample_editable_1_new").click(function(){
            var a_pos = <?php echo json_encode($this -> a_detalle);?>;
            $.post("insert.php", {
                pos: a_pos, cre: a_cre, cep: a_cep, aa: a_aa
            }, 
            function(htmlexterno){
            });
        });

Insert.php

$stmt = $conn -> prepare(" 
        INSERT INTO 
            formestonline 
            (ebelp, cre, cep, aa ) 
        VALUES 
            (?, ?, ?, ?)");
    $stmt -> bind_param("ssss", $ebelp, $cre, $cep, $aa);

    $a_pos = $_POST['pos'];
    $a_cre = $_POST['cre'];
    $a_cep = $_POST['cep'];
    $a_aa  = $_POST['aa'];

    for ($a = 0; $a < count($a_pos); $a++):
        $ebelp  = $a_pos["EBELP"][$a];
        $cre    = $a_cre[$a];
        $cep    = $a_cep[$a];
        $aa     = $a_aa[$a];
        $stmt->execute();

    endfor;
user3680708
  • 117
  • 2
  • 9

0 Answers0