Edit table with Modal

0

Good I have to modify a system in which I have to be able to edit a table the code is the following I want that there will be a modal with the information of the chosen table and to be able to edit it with ajax so as not to reload the page, I have seen a couple of tutorials and I can not get the data presented in the modal.

<?php
require "Conexion.php";
require "Config.php";
try {
$con = new Conexion();
$conn = $con-> conectar();

if(isset($_POST['Codigo'])){
    $query = "SELECT * FROM descuentos WHERE Total > pagado AND Codigo = '".$_POST['Codigo']."' ORDER BY Concepto ASC, Numero ASC;";
    $stmt = $conn->prepare($query);
    $stmt->execute();
    foreach ($stmt as $row) {
        echo "<tr>";
        $query2 = "SELECT Descripcion FROM tipo_descuentos WHERE Codigo = '".$row['Concepto']."';";
        $stmt2 = $conn->prepare($query2);
        $stmt2->execute();
        if($row2 = $stmt2->fetch()){
            echo "<td>".$row2['Descripcion']."</td>";
        }else{
            echo "<td>".$row['Concepto']."</td>";
        }
        echo "<td>".$row['Numero']."</td>";
        echo "<td>".$row['Cuotas']."</td>";
        echo "<td>".$row['CuotaActual']."</td>";
        echo "<td>".$row['Monto']."</td>";
        echo "<td>".$row['Total']."</td>";
        echo "<td>".$row['Abono']."</td>";
        echo "<td>".$row['Glosa']."</td>";
        echo "<td>".$row['FechaIngreso']."</td>";
        echo "<td>".$row['FechaInicio']."</td>";

        echo "<td><a onclick='EliminarDescuento(this);' id='".$row['Id']."' >Eliminar</a></td>";
        echo "</tr>";
    }
}else{
    echo 0;
}

}catch(PDOException $e){
    echo "ERROR: ". $e->getMessage();
}
$conn=null;
?>
    
asked by Felipe Larraguibel 11.05.2018 в 22:18
source

0 answers