What a good day! I'm working on a project and I see the need to delete files from a list, line by line, the detail is that for this to be effective, the record must also be removed from the database. Any suggestions on how to make that match with a delete button and delete the record at the same time? Part of the code is as follows:
<table id="aa">
<tr class="uno" >
<td><b>titulo</b></td>
<td><b>descripcion</b></td>
<td><b>nombre</b></td>
</tr>
<?php
include 'PDF/baterias/config.inc.php';
$db=new Conect_MySql();
$sql = "select*from baterias";
$query = $db->execute($sql);
while($datos=$db->fetch_row($query)){?>
<tr>
<td><?php echo $datos['titulo']; ?></td>
<td><?php echo $datos['descripcion']; ?></td>
<td><a href="PDF/baterias/archivo.php?id=<?php echo $datos['id_documento']?>"><?php echo $datos['nombre_archivo']; ?></a></td>
<td><form action="delete.php" method="post" name="frm">
<button onclick="deleteRow(this)">borrar</button></form></td>
</tr>
<?php } ?>
</table>
<script>
function deleteRow(r) {
var i = r.parentNode.parentNode.rowIndex;
document.getElementById("aa").deleteRow(i);
}
</script>
Thank you in advance, greetings!