Codeigniter SQL query

By : Udders
Source: Stackoverflow.com
Question!

Hi there I am trying to do a COUNT that has WHERE clauses in it, the code I am using is

function count_tasks($userId) {
    $this->db->count_all('tasks');
    $this->db->where('tasksAssignedTo', $userId);
    $query = $this->db->where('taskPriority_taskPriorityId !=', 6);

    return $query;

However Codeigniter only seems to be running the following query

SELECT COUNT(*) AS `numrows` FROM `tasks`  

Why is not running my where clauses I have a feeling that it is to with me returning $query but I dont know for sure any help on getting the WHERE's working would be a huge help.

By : Udders


Answers
By : pbarney


function count_tasks($userId) {
        $this-


Try this approach instead:

function count_tasks($userId) {

    $this-
By : Colin


This video can help you solving your question :)
By: admin