View Single Post
Old 06-19-2009, 02:52 AM   #2 (permalink)
Village Idiot
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

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.
__________________

Village Idiot is offline  
Reply With Quote