0

Ok, I am running php 5.4 and when I got the dreaded Fatal error: Function name must be a string in /home2/mydomain/public_html/session.php on line 3 I was like OH, BOY.
Here is the code it is referring to.

<?php
session_start();
session_register("userid");
session_register("name");
//session_register("ID");
//session_register("ID");
?>

<?php
session_start();
session_register("adminid");
session_register("adminname");
//session_register("ID");
//session_register("ID");
?>

Even after I tried changing it to:

<?php
session_start();
$_SESSION("adminid");
$_SESSION("adminname");
//$_SESSION("ID");
//$_SESSION("ID");
?>

I still get an error. Any help or ideas would be awesome.

Edited by diafol: misspelling

3
Contributors
2
Replies
16
Views
2 Years
Discussion Span
Last Post by Aeonix
2

Well $_SESSION isn't a function, it's an array. It should be called like $_SESSION['value'].

AND session_register has been deprectated in 5.3 and removed in 5.4

Votes + Comments
Spot on
0

This should work:

<?php
    session_start();
    $_SESSION["adminid"] = 1;
    $_SESSION["adminname"] = "Sutarusu";

    echo "Hi! I am ". $_SESSION["adminname"] .", I have ID #" . $_SESSION["adminid"];

?>

And why is this topic placed in Databases > MySQL?

Edited by Aeonix

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.