getConnection('core_write'); public function getCustomerPoints($cust_id) { $sql = "SELECT points FROM points WHERE cust_id = $cust_id"; $currentPoints = $write->fetchOne($sql); return $currentPoints; } public function saveCustomerPoints($cust_id, $points) { $write->insert('points', array('cust_id'=>$cust_id, 'points'=>$points)); } public function updateCustomerPoints($cust_id, $points) { $currentPoints = getCustomerPoints($cust_id); $write->update('points', array('points'=>$currentPoints+$points), 'cust_id='.(int)$cust_id); } }