06-19-2009, 02:52 AM
|
#2 (permalink)
|
|
Wizard
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
|
First off you are not doing this correctly, you should never leave this sort of processing to the script. Make your query
sql Code:
SELECT id FROM products WHERE id='$product_id'
Just be sure to change
$product_id = $_REQUEST['id']; to
$product_id = (int)$_REQUEST['id'];
to prevent SQL injection.
If it returns a row it exists, if there are no rows it does not.
I would strongly suggest putting anything as complicated as a shopping cart aside to learn SQL.
|
|
|
|