Having Trouble With Session Variable in Query Statement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi folks,

I'm trying to make an update query with a session variable...

It creates this error:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting
T_STRING or T_VARIABLE or T_NUM_STRING in ...

Q: the session var shows ok on the page :
ID <?php echo $_SESSION['now_poid']; ?>
- so how do I fix the error?

==========================================

<?php require_once('../Connections/dblink.php');
if(!session_id()) session_start();
$amt = 18;
$id1 = 8;
$_SESSION['thisid']=8;
$id2 = $_SESSION['thisid'] ;


  //these 3 work
$updateSQL ="UPDATE `mytable` SET thetotal=$amt WHERE id=8";
$updateSQL ="UPDATE `mytable` SET thetotal=$amt WHERE id=$id1";
$updateSQL ="UPDATE `mytable` SET thetotal=$amt WHERE id=$id2"; // uses
$_SESSION['thisid']

//but this does not..
$updateSQL ="UPDATE `mytable` SET thetotal=$amt WHERE
id=$_SESSION['thisid']";

Q: How can I fix it?






--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists 09]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux