tags:

views:

34

answers:

1
 session_start();
//login page
if(mysql_num_rows($result) != '0'){ // If match.

        session_register("username"); // Craete session username.

        header("location:admin/admin.php"); // Re-direct to admin.php    
    exit;

    }else{ // If not match.

        $message="Please Incorrect your account !";

    }

//After login successfully go to admin.php

session_start();

echo $_SESSION['username'];

Anybody here know to solve the problems?

+1  A: 

try setting the variable:

if (mysql_num_rows($result)) {
    $_SESSION['username'] = "something";
    header(....); exit;
} // etc
nickf
thanks nickf for me is: $_SESSION['username'] = (string)$_POST["username"];
python
@python: it'll already be a string, so you won't need to cast it.
nickf