Re: Warning: Cannot add header information

From: Date: Wed, 12 Sep 2001 15:58:30 +0000
Subject: Re: Warning: Cannot add header information
References: 1  Groups: php.general.es 
Request: Send a blank email to general-es+get-13789@lists.php.net to get a copy of this message
> Tengo este problema , cuando el user se loguea a traves de un Form lo > tiene que redireccionar a una url , y tonces uso el Header , pero me > dice > Warning: Cannot add header information - headers already sent by (output > started at /home/httpd/vhost/hosting/html/Login.php:20) in > /home/httpd/vhost/hosting/html/Login.php on line 21 > Aca les pasteo el Login.php > <? > > $connection = mysql_connect("localhost", "root", "uksuvaso") > or die ("Couldn't connect to server."); > > $db = mysql_select_db("kzt_secret", $connection) > or die ("Couldn't select database."); > > $sql = "SELECT id > FROM kzt_secret > WHERE IDUser='$IDUser' and IDPass='$IDPass'"; > > $result = mysql_query($sql) > or die("Couldn't execute query."); > > $num = mysql_numrows($result); > > if ($num == 1) { > > header("Location: $IDRedir"); > } else if ($num == 0) { > > echo "You are not authorized!"; > > } > > ?> lo mas probable es que estes enviando un espacio en blanco antes del header por que al parecer no envias ninguna etiqueta HTML antes de ese header, a mi me ocurrio lo mismo no tenia etiquetas, ni siquiera un echo, lo que pasaba era que tenia un linea en blanco al principio de la pagina espero que sea eso suerte Luis Moya B.

« previous php.general.es (#13789) next »