prob with $_session

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bugthefixer
Forum Contributor
Posts: 118
Joined: Mon Mar 22, 2004 2:35 am

prob with $_session

Post 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
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

I prefer:

Code: Select all

<?php
    echo 'variable is ' . $_SESSION['stname'];
    // or...
    echo "variable is {$_SESSION['stname']}";
?>
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

yeah, just use single quotes are concatenate the two bits
Post Reply