From 8082cc98e7ebc9a27dcf8a8a4e6ee24dc71af1f3 Mon Sep 17 00:00:00 2001 From: Rafael Bodill Date: Fri, 19 Sep 2014 18:36:51 +0300 Subject: where_in for in array queries a proper count usage --- application/controllers/file.php | 2 +- application/controllers/user.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/application/controllers/file.php b/application/controllers/file.php index 96c3fb9c6..ddb7a38cf 100644 --- a/application/controllers/file.php +++ b/application/controllers/file.php @@ -541,7 +541,7 @@ class File extends MY_Controller { ->select('id, filename, mimetype, date, hash, filesize') ->from('files') ->where('user', $user) - ->where('mimetype', array('image/jpeg', 'image/png', 'image/gif')) + ->where_in('mimetype', array('image/jpeg', 'image/png', 'image/gif')) ->order_by('date', 'desc') ->get()->result_array(); diff --git a/application/controllers/user.php b/application/controllers/user.php index a9e50d742..57c6498b1 100644 --- a/application/controllers/user.php +++ b/application/controllers/user.php @@ -175,13 +175,13 @@ class User extends MY_Controller { $userid = $this->muser->get_userid(); - $query = $this->db->select('user') - ->from('action') + $invitations = $this->db->select('user') + ->from('actions') ->where('user', $userid) ->where('action', 'invitation') ->count_all_results(); - if ($query["count"] + 1 > 3) { + if ($invitations + 1 > 3) { show_error("You can't create more invitation keys at this time."); } -- cgit v1.2.3-24-g4f1b