Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function listar_noticias($conexion){
- ?>
- <table class="table">
- <thead>
- <tr>
- <th>ID</th>
- <th>Autor</th>
- <th>Titulo</th>
- <th>Categoria</th>
- <th>Update</th>
- <th >Editar</th>
- <th>Eliminar</th>
- </tr>
- </thead>
- <?php
- $sql = "SELECT * FROM noticias ORDER BY id ASC ";
- $resultado = $conexion->query($sql);
- while($row = mysqli_fetch_array($resultado))
- {
- ?>
- <tbody>
- <tr>
- <td><?php echo $row['id']; ?></td>
- <td><?php echo $row['autor']; ?></td>
- <td><?php echo $row['titulo']; ?></td>
- <td><?php echo $row['categoria']; ?></td>
- <td><?php echo $row['update']; ?></td>
- <td><a href="#">Editar</a></td>
- <td><a href="./elim.php?id=<?php echo $row ['id']; ?>">Eliminar</a></td>
- </tr>
- </tbody>
- <?php
- }
- ?>
- </table>
- <?php
- }
- function eliminar_noticia($conexion){
- $id = $_GET['id'];
- $sql = "DELETE FROM noticias WHERE id = '$id'";
- $resultado = $conexion->query($sql);
- if ($resultado) {
- echo "El registro fue eliminado correctamente";
- } else {
- echo "Error al eliminar el registro selecionado";
- }
- return $id;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement