Re: php

From: Date: Sat, 17 Feb 2001 21:10:35 +0000
Subject: Re: php
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-40376@lists.php.net to get a copy of this message
from: http://www.php.net/manual/en/function.header.php "Remember that the header() function must be called before any actual output is sent, either by normal HTML tags blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that will output before header() is called. The same problem exists when using a single PHP/HTML file." - John Vanderbeck - Admin, GameDesign ----- Original Message ----- From: "Brandon Feldhahn" <BrandonFeldhahn@earthlink.net> To: <php-general@lists.php.net> Sent: Saturday, February 17, 2001 4:05 PM Subject: [PHP] php > im trying to make somthing that takes the user to the members page if > the authentecation is right, but i keep getting this error: > > Warning: Cannot add header information - headers already sent by (output > started at C:\www\login2.PHP:7) in C:\www\login2.PHP on line 30 > > and this is my code: > > <HTML> > <HEAD> > > <TITLE>My Login Form</TITLE> > </HEAD> > > <? > require ('header.php'); > switch ($do) { > > case "authenticate": > > $connection = mysql_connect("localhost", "brandon", "******") > or die ("Couldn't connect to server."); > > $db = mysql_select_db("TNB", $connection) > or die ("Couldn't select database."); > > $sql = "SELECT id > FROM members > WHERE username='$username' and password='$password'"; > > $result = mysql_query($sql) > or die("Couldn't execute query."); > > $num = mysql_numrows($result); > > if ($num == 1) { > > header("Location:index.php"); > > }else if ($num == 0) { > > unset($do); > echo "<font color='ff0000'>You are not authorized! Please try > again.</font></p>"; > include("login_form.irc"); > > } > > break; > > default: > > include("login_form.irc"); > > } > require ('footer.php'); > ?> > > </BODY> > </HTML> > > Line 30 is in bold. > what should i do? PLEASE HELP > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.general (#40376) next »