>Whats the difference between $_SESSION[foo] and $_SESSION['foo'] I have >been using the 's but they seem to be unecessary?
Use the single-quotes -- array references often work without them, but the potential for conflict with constants and future PHP incompatibility is a possibility. If you (or PHP) had a constant foo defined, it would behave unexpectedly. >I run into trouble if I try something like: >$query = " select * from table where (test.id = '$_SESSION['foo']') "; >but the following works: >$query = " select * from table where (test.id = '$_SESSION[foo]') "; http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing // Works but note that this works differently outside string-quotes echo "A banana is $fruits[banana]."; // Works echo "A banana is {$fruits['banana']}."; // Works but PHP looks for a constant named banana first // as described below. echo "A banana is {$fruits[banana]}."; // Won't work, use braces. This results in a parse error. echo "A banana is $fruits['banana']."; --------------------------------------------------------------------- michal migurski- contact info and pgp key: sf/ca http://mike.teczno.com/contact.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php