I noticed that when a user pays for sms premium, table item_sms_premium_expires inserts a new row instead of updating the existing row that contains value NULL or a previous expire date.
A big issue when a user wants to pay during his premium period to extend the date and sees that the date is set to the same date he has already payed for.
Instead of updating the existing row that contains date or NULL it creates a new date but when you hover on live site to button premium it shows the old date because the empty row is there and outputs the empty row.
In model the function looks correct so i don't now what is wrong.
I believe =NULL cannot be found as a value null so i thought to change model to IS NULL but that screws up the whole webiste.
code in model: public function updateExpireByItemId( $item_id, $date = NULL ) {
$aSet = array('expire_date' => $date);
$aWhere = array('item_id' => $item_id);
return $this->_update($this->getTable_PremiumExpire(), $aSet, $aWhere);
}
public function insertExpireByItemId( $item_id, $date ) {
$aSet = array(
'item_id' => $item_id,
'expire_date' => $date
);
return $this->dao->insert( $this->getTable_PremiumExpire(), $aSet);
}
Attached a screenshot from what happens in db... 4 rows with same item_id after payment when expired and renewed 3 times for 30 days.
The NULL does not gets updated after payment and it leaves the old day as is ... Instead it creates extra rows with a new date.... or same date starting from NULL