Foros del Web » Programando para Internet » PHP »

eliminar registros en php

Estas en el tema de eliminar registros en php en el foro de PHP en Foros del Web. necesito eliminar registros de la base de datos a traves de el siguiente codigo: eliminar.php <?php include('connexion.php'); $result=mysql_query("select * from eventos"); echo" <BR><BR><table width=\"550\" height=\"50\" ...
  #1 (permalink)  
Antiguo 21/04/2008, 12:23
 
Fecha de Ingreso: febrero-2007
Mensajes: 1
Antigüedad: 17 años, 2 meses
Puntos: 0
eliminar registros en php

necesito eliminar registros de la base de datos a traves de el siguiente codigo:

eliminar.php

<?php
include('connexion.php');
$result=mysql_query("select * from eventos");
echo" <BR><BR><table width=\"550\" height=\"50\" borde bordercolor=\"#003399\" align=\"center\" border=\"2\">
<tr>
<td width=\"100\" height=\"90\" rowspan=\"2\" bgcolor=\"#003399\"><div align=\"center\"><img src=\"imagenes/unefa.png\" width=\"70\" height=\"80\" align=\"middle\" /></div></td>
<td width=\"300\" height=\"30\">
<p align=\"center\" class=\"Estilo3\">AUDITORIO ALÍ PRIMERA</p></TD>
<td width=\"100\" height=\"90\" rowspan=\"2\" bgcolor=\"#003399\"><div align=\"center\"><img src=\"imagenes/pasillo3.jpg\" width=\"90\" height=\"80\" align=\"middle\" /></div></td>
</tr>
<tr>
<td bgcolor=\"#0066FF\"><div align=\"center\" class=\"Estilo1\">";
setlocale (LC_TIME,"spanish");
echo"<div align=right><strong>";
echo strftime("%d de %B del %Y");
echo"</strong></div>";
echo" </div>
</td>
</tr>
</table>
<table background=\"imagenes/Auditorio1.jpg\" width=\"550\" height=\"50\" borde=\"0\" bordercolor=\"#003399\" align=\"center\">
<tr>
<td colspan=\"2\"><p>
<table width=\"550\" height=\"100\" border=\"0\" align=\"center\">
<br><tr>
<td>
<p align=\"center\"><strong><font size=5 color=\"0033cc\">Eliminar Evento</font></strong></p>
<center><TABLE BORDER=1 CELLSPACING=2 CELLPADDING=4>
<TR>
<TD bgcolor=\"#003399\"><font color=\"#FFFFFF\"><strong>&nbsp;<B>codigo evento</B></strong></font></TD>
<TD bgcolor=\"#003399\"><font color=\"#FFFFFF\"><strong>&nbsp;<B>Fecha</B></strong></font></TD>
<TD bgcolor=\"#003399\"><font color=\"#FFFFFF\"><strong>&nbsp;<B>Nombre</B></strong></font>&nbsp;</TD>
<TD bgcolor=\"#003399\"><font color=\"#FFFFFF\"><strong>&nbsp;<B>Borrar</B></strong></font>&nbsp;</TD>
</TR>";
while($row = mysql_fetch_array($result)) {
printf("<tr><td>&nbsp;%s</td><td>&nbsp;%s&nbsp;</td><td>&nbsp;%s&nbsp;</td><td><a href=\"borra.php?id=?\">Borra</a></td></tr>", $row["id_evento"],$row["fecha"],$row["nombre_evento"],$row["ID_Prueba"]);
}
mysql_free_result($result);
echo"</TABLE></center>
<br>
<table width=\"530\" border=\"0\" align=\"center\">
<tr>
<td>
<center><input name=\"boton\" type=\"button\" onClick=\"javascript:history.go(-1)\" value=\"Cancelar\" />
</td>
</tr><br>
</table></center>
</form>
<tr>
<td colspan=\"2\" bgcolor=\"#003399\">&nbsp;</td>
</tr>
<tr>
<td>
</table>
</table>";
?>


borrar.php

<?php
include('connexion.php');
// $link=Conectarse();
$id_evento=$_GET['id_evento'];
mysql_query("delete from eventos where where ID_Prueba = '$id_evento'");

header("Location:eliminar.php");
?>


pero no me elimina el registro y me aparece el siguiente mensaje de error:

Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\audiovisuales\borra.php:9) in C:\wamp\www\audiovisuales\borra.php on line 15
que es esta linea:
header("Location:eliminar.php");

por favor ayudenme
  #2 (permalink)  
Antiguo 21/04/2008, 13:01
Avatar de BrujoNic
Super Moderador
 
Fecha de Ingreso: noviembre-2001
Ubicación: Costa Rica/Nicaragua
Mensajes: 16.935
Antigüedad: 22 años, 5 meses
Puntos: 655
Re: eliminar registros en php

Trasladado de BD a PHP. Favor no poner código de programación en BD.

Función de la sección de Base de Datos
__________________
La tecnología está para ayudarnos. No comprendo el porqué con esa ayuda, la gente escribe TAN MAL.
NO PERDAMOS NUESTRO LINDO IDIOMA ESPAÑOL
  #3 (permalink)  
Antiguo 21/04/2008, 15:15
Avatar de Carlojas  
Fecha de Ingreso: junio-2007
Ubicación: Shikasta
Mensajes: 1.272
Antigüedad: 16 años, 10 meses
Puntos: 49
Re: eliminar registros en php

Mira este post

http://www.forosdelweb.com/2037876-post179.html

Verifica tambien que tu consulta co tenga errores

Código PHP:
<?php 
include('connexion.php');
$link Conectarse(); 
$id_evento $_GET['id_evento']; 
$result mysql_query("delete from eventos where  ID_Prueba = '$id_evento'"$link) or die( mysql_error() ); 
header("Location:eliminar.php");
?>
Saludos.

Última edición por Carlojas; 21/04/2008 a las 15:22
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 05:15.