There's bug in SQL statement in
PHP Code:
function update_customer_credit($customers_id, $amount){
global $db;
$sql='INSERT INTO '.TABLE_STORE_CREDIT.' VALUES (\''.$customers_id.'\', \''.$amount.'\') ON DUPLICATE KEY UPDATE reward_points=reward_points+'.$amount.';';
$db->Execute($sql);
if(mysql_affected_rows($db->link) == 1)
return true;
return false;
}
it should be
PHP Code:
function update_customer_credit($customers_id, $amount){
global $db;
$sql='INSERT INTO '.TABLE_STORE_CREDIT.'(customers_id, amount) VALUES (\''.$customers_id.'\', \''.$amount.'\') ON DUPLICATE KEY UPDATE reward_points=reward_points+'.$amount.';';
$db->Execute($sql);
if(mysql_affected_rows($db->link) == 1)
return true;
return false;
}
I added "(customers_id, amount)" in sql statement after TABLE_STORE_CREDIT.
Bookmarks