RE: [PHP] uh, oh errors?
| From: | Patrick Lynch | Date: | Thu, 16 May 2002 17:13:20 +0000 |
| Subject: | RE: [PHP] uh, oh errors? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-97932@lists.php.net to get a copy of this message | ||
Hi Jas,
I normally output can output a JaveScript
document.location.href="XXX.XXX"; command
Plan B is to do your processing before there is any output and then
decide whether or not to do a redirect using the header() function.
Best Regards,
Patrick Lynch.
Optip Ltd, Internet & Mobile Development
Co. Clare, Ireland.
http://www.optip.com/
-----Original Message-----
From: Jas [mailto:jlgerfen@hotmail.com]
Sent: 16 May 2002 18:11
To: php-general@lists.php.net
Subject: [PHP] uh, oh errors?
Not sure how to resolve this, looked at php.net for the headers
available and this is the error I am recieving:
Warning: Cannot add header information - headers already sent by (output
started at /path/to/connection/script/db.php:6) in
/path/to/login/checking file/auth_done.php on line 13
Here is the code that is in auth_done.php:
session_start();
require '/path/to/login/checking file/db.php';
$db_table = 'auth_users';
$sql = "SELECT * from $db_table WHERE un = \"$u_name\" AND pw =
password(\"$p_word\")"; $result = @mysql_query($sql,$dbh) or
die("Couldn't execute query"); $num = mysql_numrows($result); if ($num
!=0) {
session_register('u_name');
session_register('p_word');
$msg_success = "Good freakin job poindexter!!";
} else {
header ("Location: index.php"); // This is line 13 that is my error
generator
}
This is the code for the db.php script:
<?php
$dbh = mysql_connect('localhost','username','password') or
die('Could
not connect to database, please try again later');
mysql_select_db('db_name') or die('Could not select database, please try
again later'); ?>
Any help would be great! I am assuming there is another way to redirect
users besides the header function, just not sure what it is or how to
use it. Thanks in advance, Jas
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php