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;

}

Link to comment
Share on other sites

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";

}

 

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.