Foros del Web » Programando para Internet » PHP »

problema con header

Estas en el tema de problema con header en el foro de PHP en Foros del Web. Hola a todos, Tengo una página para eliminar imágenes de una base de datos y funciona correctamente, pero al borrar la imagen se queda la ...
  #1 (permalink)  
Antiguo 15/06/2005, 10:25
 
Fecha de Ingreso: agosto-2004
Mensajes: 349
Antigüedad: 19 años, 7 meses
Puntos: 3
problema con header

Hola a todos,

Tengo una página para eliminar imágenes de una base de datos y funciona correctamente, pero al borrar la imagen se queda la pantalla en blanco y me gustaría que una vez borrada me redireccionase al menú otra vez.

He probado con "header" y en local me va bien, pero al subirlo al server no me redirecciona.

Dejo aquí el código, a ver si alguien me puede ayudar:

Código PHP:
<?include ("seguridad.php");?>
<?php 
require_once('../Connections/estepa.php'); ?>
<?php
function GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}

if ((isset(
$_GET['id'])) && ($_GET['id'] != "")) {
  
$deleteSQL sprintf("DELETE FROM archivos WHERE id=%s",
                       
GetSQLValueString($_GET['id'], "int"));

  
mysql_select_db($database_estepa$estepa);
  
$Result1 mysql_query($deleteSQL$estepa) or die(mysql_error());
}

mysql_select_db($database_estepa$estepa);
$query_Recordset1 "SELECT * FROM archivos";
$Recordset1 mysql_query($query_Recordset1$estepa) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 mysql_num_rows($Recordset1);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

</body>
</html>
<?php
header
("location: jardines_del_im.php"); 
mysql_free_result($Recordset1);
?>
Gracias por su ayuda.

un Saludo!
  #2 (permalink)  
Antiguo 15/06/2005, 10:30
 
Fecha de Ingreso: mayo-2005
Mensajes: 103
Antigüedad: 18 años, 11 meses
Puntos: 1
Para que funcione el header no puedes escribir nada de codigo html.

Por lo tanto ese codigo no te funcionaria, quita esas etiquetas <html>... etc que si te das cuenta por otra parte no te sirven de nada.

Un saludo.
  #3 (permalink)  
Antiguo 15/06/2005, 11:33
 
Fecha de Ingreso: agosto-2004
Mensajes: 349
Antigüedad: 19 años, 7 meses
Puntos: 3
Gracias Morphoide,

vaya despiste!!!

Un Saludo!
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:28.