Re: session/header problem (warning:newbie with sessions)
| From: | Comex | Date: | Sat, 17 May 2003 22:12:11 +0000 |
| Subject: | Re: session/header problem (warning:newbie with sessions) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-148052@lists.php.net to get a copy of this message | ||
Ryan A wrote:
> Hi,
> These are the notices/warnings i am getting and the page exits:
>
> Notice: Undefined variable: row in
> c:\phpdev\www\bwh\co.authenticate.login.php on line 19
>
> Notice: Undefined variable: row in
> c:\phpdev\www\bwh\co.authenticate.login.php on line 20
>
> Warning: Cannot add header information - headers already sent by
> (output started at c:\phpdev\www\bwh\co.authenticate.login.php:19) in
> c:\phpdev\www\bwh\co.authenticate.login.php on line 21
>
>
> this is my tiny code:
> <?php
> error_reporting (E_ALL);
> include_once("configbwh.php");
>
> $user= $_POST["user"];
> $pass= $_POST["pass"];
>
> if(isset($user) && $user && isset($pass) && $pass)
> {
> $connected=mysql_connect ("$hostt", "$userr", "$passs") or die
> ('I
> cannot connect to the database because: ' . mysql_error());
> mysql_select_db ("$db");
>
> $database["sql"] = " select user,pass from main_co where
> user='".$user."' and pass='".$pass."'";
>
> $result = mysql_query($database["sql"]) or die("Error: " .
> mysql_error());
> if(mysql_num_rows($result) == 1)
> {
> session_start();
> $_SESSION['user'] = $row[15];
> $_SESSION['pass'] = $row[16];
> header("Location:co.details.php");
> exit;
> }
> }
>>
>
> what am i doing wrong?
>
> Kindly reply,
> -Ryan
Well, you're referencing $row before your Location: header. You never set
$row. The third error is because you can't send headers out after you put
out some text... and the error reporting counts as text :). When you're
using header, you usually get that message with other errors.
1.41421356237309504880168872420969807856967187537694
Yes, it's true that the above isn't not false, unless it isn't.
The search is more profitable than the find.
Never, ever back down.
The e-mail given is a spam trap.
..==// Why not? \\==..