Page 1 of 1

prob with $_session

Posted: Wed Apr 21, 2004 4:30 pm
by bugthefixer
when i write code like this

Code: Select all

<?php
echo "variable is $_session["stname"]";

?>
i get error saying expecting number string or something like this..
in other words it doesnt recognise escaping characters..
wat cud be the prob

Posted: Wed Apr 21, 2004 4:32 pm
by JAM
I prefer:

Code: Select all

<?php
    echo 'variable is ' . $_SESSION['stname'];
    // or...
    echo "variable is {$_SESSION['stname']}";
?>

Posted: Thu Apr 22, 2004 1:51 am
by Chris Corbyn
yeah, just use single quotes are concatenate the two bits