php - Codeigniter SQL query -


Hello there I am trying to do that COUNTER with the WHERE clause in it, I am using the code

  function count_tasks ($ userId) {$ this- & gt; Db- & gt; Count_all ('work'); $ This- & gt; Db- & gt; Where ('tasksAssignedTo', $ userId); $ Query = $ this- & gt; Db- & gt; Where ('taskPriority_taskPriorityId!' ', 6); Return $ query;  

However only the following Q & A codehit looks like

  SELECT COUNT (*) AS 'function' with 'numrows`  

Why is not it where I am feeling that it is returning the $ query with me, but I do not know that any help would be of great help to WHERE's work.

  function count_tasks ($ userId) {$ this- & gt; Db- & gt; Count_all ('work'); $ This- & gt; Db- & gt; Where ('tasksAssignedTo', $ userId); $ Query = $ this- & gt; Db- & gt; Where ('taskPriority_taskPriorityId!' ', 6); Return $ query;  

Modify your query The count_all function stops the SQL building class.

  function count_tasks ($ userId) {$ this- & gt; Db- & gt; Where ('taskssignedTo' $ userId); $ This- & gt; Db- & gt; Where ('taskPriority_taskPriorityId!' ', 6); $ Query = $ this- & gt; Db- & gt; Counting_all ('work'); Return $ query; }  

Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -