$_SESSION in WHERE statement

$_SESSION in WHERE statement

carrarachristophecarrarachristophe Posts: 40Questions: 11Answers: 0

Error messages shown: Undefined variable: _SESSION...
Description of problem:

I am trying to add some $_SESSION information to a WHERE statement using:

Editor::inst( $db, 'bibliotheque_bibliotheques', 'bibliotheque_id' )
    ->where( 'utilisateurs.utilisateur', $_SESSION['username'] )
    ->debug( true )
    ->process( $_POST )

I am getting the following error message: Undefined variable: _SESSION...

I know the rest of the code is correct because:
1. when I replace $_SESSION['username'] by an existing value it works fine
2. When I remove that part, the $_SESSION['username'] appears fine outside of the datatable, through:

    <?php include("includes/header.php"); ?>

How can I define $_SESSION['username'] in the php?

Thanks and regards,



  • sasmitsasmit Posts: 5Questions: 1Answers: 0

    Have you used session_start() at the top of the page?

Sign In or Register to comment.