Skip to content

Commit

Permalink
fix for that issue both display and count
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua1234511 committed May 30, 2017
1 parent 189b189 commit 4268a70
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions application/models/Giftcard.php
Expand Up @@ -18,9 +18,12 @@ public function exists($giftcard_id)
*/
public function get_max_number()
{
$this->db->select_max('giftcard_number');
$this->db->select('cast(giftcard_number AS UNSIGNED) AS giftcard_number');
$this->db->from('giftcards');
$this->db->where('giftcard_number REGEXP', "'^[0-9]+$'", FALSE);
$this->db->order_by("giftcard_number","desc");
$this->db->limit(1);


return $this->db->get()->row();
}
Expand Down Expand Up @@ -108,7 +111,7 @@ public function save(&$giftcard_data, $giftcard_id = -1)
{
if($this->db->insert('giftcards', $giftcard_data))
{
$giftcard_data['giftcard_id'] = $this->db->insert_id();
$giftcard_data['giftcard_number'] = $this->db->insert_id();

return TRUE;
}
Expand Down

0 comments on commit 4268a70

Please sign in to comment.