Codeigniter SQL query

By : Udders

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->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

By : pbarney

function count_tasks($userId) {

Try this approach instead:

function count_tasks($userId) {

By : Colin

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