Jump to content

Can't use function return value in write context


miklesw

Recommended Posts

I'm getting this error just before this function.. can't figure it out..pls help

 

function createSession(){

global $conn, $dbname;

global $AgentEmail,$AgentFirstName,$AgentLastName,$AgentIsVerified,$AgentID;

session_start();

$_SESSION("Username")= $POST_User;

$_SESSION("Email")= $AgentEmail;

$_SESSION("AgentID")= $AgentID;

$_SESSION("FirstName")= $AgentFirstName;

$_SESSION("LastName")= $AgentLastName;

}

The error is:

[Tue Sep 04 20:34:08 2007] [error] [client 127.0.0.1] PHP Fatal error:  Can't use function return value in write context in C:\\Apache2.2\\htdocs\\eProperty\\init.php on line 36

 

I execute the function before in an include before the <head>

 

The error is also happening with other functions (not all of them) .. it comes up with the first one it encounters..

 

function hasAuthSession() {

if(isset($_SESSION) && isset($_SESSION("Username") && isset($_SESSION("AgentID")){

return true;

}else {

return false;

}

}

 

function GetPageLocation($PageCode) {

if ($PageCode=="login") $PageCode="myacc" ;

        return "My Account";

}

 

function GetPageTitle($PageCode) {

if ($PageCode=="login") $PageCode="myacc";

        return "content/agentarea/myacc.php";

}

 

 

session_start() needs to be exectuted before anything else in your php file. So, you can't use it in another function.

 

AFAIK this is untrue.  session_start modifies header information so only needs to be called before any output is sent to the browser or before the $_SESSION variable is used.

 

How are these functions being called?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.