lammy Posted October 21, 2007 Share Posted October 21, 2007 (edited) Hello, The idea is to.... 1] Make prospective affiliates register as customers and place a minimum amount order to be able to join as affiliates. For that code [sql-qry] in affiliate_signup.php [~line 192] edited. 2] Make system check affiliate login and verify weather the affiliate is a customer and has made certain amount of purchase. For that code in affiliate_affiliate.php [~line 23] edited. Following are the codes tested and error produced... Other than affiliate table, order table too is queried.... ======== $check_email_query = tep_db_query("SELECT count(customers_email_address) AS total, currency_value, order_status FROM order WHERE order_status => '2' AND (customers_email_address = '".tep_db_input($a_email_address)."') GROUP BY customers_email_address HAVING (SUM(currency_value)=> 50)"); $check_email = tep_db_query("select affiliate_email_address from " . TABLE_AFFILIATE . " where affiliate_email_address = '" . tep_db_input($a_email_address) . "'"); $check_c_email = tep_db_fetch_array($check_email_query); if ($check_c_email['total'] < 1) { $error = true; $message = Be a customer, then register; }elseif (tep_db_num_rows($check_email)) { $error = true; $entry_email_address_exists = true; } else { $entry_email_address_exists = false; } ========ERROR===for above query====== 1064 - 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 'order WHERE order_status => '2' AND (customers_email_address = '[email protected]'' at line 1 SELECT count(customers_email_address) AS total, currency_value, order_status FROM order WHERE order_status => '2' AND (customers_email_address = '[email protected]') GROUP BY customers_email_address HAVING (SUM(currency_value)=> 2) ===ERROR 2===For change ===(customers_email_address = '".tep_db_input($a_email_address)."')===to===_address)."'")=== Parse error: syntax error, unexpected T_STRING in ****\_htdocs\*****\affiliate_signup.php on line 208 ======== Now for checking customer table before affiliate allowed to login edit affiliate_affiliate.php // Check if C & A username exists $check_email_query = tep_db_query("SELECT count(customers_email_address) AS total, currency_value, order_status FROM order WHERE order_status => '2' AND (customers_email_address = '".tep_db_input($a_email_address)."') GROUP BY customers_email_address HAVING (SUM(currency_value)=> 50)"); $check_affiliate_query = tep_db_query("select affiliate_id, affiliate_firstname, affiliate_password, affiliate_email_address from " . TABLE_AFFILIATE . " where affiliate_email_address = '" . tep_db_input($affiliate_username) . "'"); $check_c_email = tep_db_fetch_array($check_email_query); if ($check_c_email['total'] < 1) { $error = true; $message = 'Be a customer, then register as an affiliate, then login'; }else{ (!tep_db_num_rows($check_affiliate_query)) { $HTTP_GET_VARS['login'] = 'fail'; # } else { $check_affiliate = tep_db_fetch_array($check_affiliate_query); ======================above too has produced an error====================== can anybody from the community help me with correct codes please help Lammy Edited October 21, 2007 by lammy Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.