JosiahBradley
[H]ard|Gawd
- Joined
- Mar 19, 2006
- Messages
- 1,791
In PHPmyAdmin when I run the following line
I am happily given the result which is 1
However when I execute this sql query in php
where the session varibles are correctly set to 1 and 6 and 1, I recieve the following error:
If I run a query with only one thing in the WHERE cluase it executes fine, but I need the other values to be able to select my ProductID.
Code:
SELECT product.ProductID FROM product WHERE WineID= 1 && CaseQuantity=6 && BottleUsedID=1
However when I execute this sql query in php
PHP:
$sql = "SELECT product.ProductID FROM product WHERE WineID= ". $WineID ." && CaseQuantity=". $_SESSION['Case_Selected'] ." && BottleUsedID=". $_SESSION['Bottle_Selected'];
I have tried using AND and get the same error. As you can tell the error message contains the correct values 6 and 1.You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '&& CaseQuantity=6 && BottleUsedID=1' at line 1
If I run a query with only one thing in the WHERE cluase it executes fine, but I need the other values to be able to select my ProductID.