![]() |
Looping Through MySQL Queries
Okay so my issue is that I am trying to loop through $_SESSION variables with each element of that array getting a query (that checks the database for its existence). I am having problems figuring out the correct way to do the syntax, especially for the query.
Essentially I am trying to concatenate the element name from the $_SESSION array with the variable $n which will just be an integer increasing by 1 every time it goes through the loop. PHP Code:
Code:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/kylhur/ecommerce.danconia.us/cart.php on line 46 |
Your problem is this:
WHERE product_id = $_SESSION['item_'" . $n]" More specifically $_SESSION['item_'" . $n]" Id work that out before the query statement, before the while statement: PHP Code:
|
| All times are GMT +1. The time now is 05:57 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.