1

I'm trying to work with Jamie Rumbelow's MY_Model and I'm running into an issue with figuring out how I can use the count method with an array.

I want to count the total number of personal unread messages the logged user has received.

So I was going to try the following call:

$unread_messages = $this->personal_messsages->count_by();

However, I need to also pass in the user_id of the user and an integer to know if the message was unread or read.

Any ideas on how to perform this?

4

1 回答 1

1

不幸的是, count_by() 只能处理单个字段和值,而不是数组(除非他已更新)。您必须为此编写自己的

查看此链接以查看所有 MY_Model 函数的示例:http://codebyjeff.com/blog/2012/01/using-jamie-rumbelows-my_model

编辑:我可能会对此进行纠正:尝试传入 array('user_id'=>$user_id, 'status'=>1); (根据您自己的值进行调整),这可能有效

于 2013-08-20T08:35:35.613 回答