Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

314
Vistas
El botón Eliminar no funciona en las filas de la tabla

Estoy tratando de agregar un botón de eliminación en cada fila para poder eliminar un registro cuando se presiona el botón. Pero la función de eliminación no funciona y muestra "Error al eliminar el registro". No sé dónde está el problema.

Por favor, ayúdame. Cualquier ayuda sería apreciada.

Aquí está mi código:

gestionarhorario.php

 <?php include("include/config.php"); $sql = "SELECT * FROM `time_table`"; $query = mysqli_query($link,$sql) or die(mysqli_error($link)); ?> <table width="70%" cellpadding="5" cellspacing="5"> <tr> <th><strong>ID</strong></th> <th><strong>Image</strong></th> <th></th> </tr> <?php while ($row = mysqli_fetch_array($query)) : ?> <tr> <td><?php echo $row['t_id']; ?></td> <td><?php echo $row['t_name']; ?></td> <td><a href='delete.php?id=".$row['t_id']."'>Delete</a></td> </tr> <?php endwhile; ?> </table>

borrar.php

 <?php $id = $_GET['id']; include("include/config.php"); $sql = "DELETE FROM time_table WHERE t_id = $id"; if (mysqli_query($link, $sql)) { mysqli_close($link); header('Location: index.php'); exit; } else { echo "Error deleting record"; } ?>

config.php

 <?php $link=mysqli_connect("localhost","root","","course_registration_system"); ?>

Mi base de datos: Time_table

 t_id t_name t_image 8 course_offered_2017.jpg [BLOB - 246.1 KiB] 9 time_table_2017.jpg [BLOB - 446.4 KiB]
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Reemplazar esto

 <td><a href='delete.php?id=".$row['t_id']."'>Delete</a></td>

con

 <td><a href='delete.php?id=<?php echo $row["t_id"];?>'>Delete</a></td>

* Intenta usarpdo

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda