Try this ... paren issues and that , after the products_id in the array ...
Code:// bof: do not allow customer to add to cart if already purchased // if not logged in and a free product make login if (!$_SESSION['customer_id'] && in_array((int)$product_id, array(65, 64 )) ) { return 'login for free product'; } if ( in_array((int)$product_id, array(65, 64 )) ) { $chk_product_purchased_query = "select distinct op.products_id, o.orders_id from " . TABLE_ORDERS_PRODUCTS . " op left join " . TABLE_ORDERS . " o on o.orders_id = op.orders_id where op.products_id = '". (int)$product_id . "' and o.customers_id='" . $_SESSION['customer_id'] . "'"; $chk_product_purchased = $db->Execute($chk_product_purchased_query); if (!$chk_product_purchased->EOF) { return 'You have already received this offer!'; } } // eof: do not allow customer to add to cart if already purchased



