Portal Home > Knowledgebase > Articles Database > Why dose this not work?
Why dose this not work?
Posted by Danny159, 08-27-2007, 02:24 PM |
Hey
Why dose this not work
SELECT * FROM invoice WHERE clientid = '$_SESSION['username']' ORDER BY id
I have a at the top of the script so thats where the username comes from
I get this error
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/master/public_html/customers/old/new/invoice/view.php on line 17
|
Posted by sasha, 08-27-2007, 02:37 PM |
This would work:
SELECT * FROM invoice WHERE clientid = '{$_SESSION['username']}' ORDER BY id
or better
SELECT * FROM invoice WHERE clientid = '" . mysql_real_escape_string($_SESSION['username']) ."' ORDER BY id
|
Posted by Jatinder, 08-27-2007, 02:42 PM |
|
Posted by Danny159, 08-27-2007, 02:58 PM |
Thanks mate
|
Add to Favourites Print this Article
Also Read