Welcome Guest, Not a member yet? Register   Sign In
[Solved] Count where
#1

[eluser]nebulom[/eluser]
Is there any way I can count where? Like
Code:
->count_where('SOME_TABLE', array('COLUMN', $value))
Or any other solution related to this problem? Thanks in advance.
#2

[eluser]davidbehler[/eluser]
Code:
$this->db->where('COLUMN', $value);
$this->db->from('SOME_TABLE');
echo $this->db->count_all_results();
#3

[eluser]nebulom[/eluser]
Ok, thanks. I thought there might be a one-liner solution. Again, thanks a lot.
#4

[eluser]Jagar[/eluser]
If you are using PHP5 you can use the chaining method as follow:

Code:
$this->db->from('table_name')->where('column_name',value)->count_all_results();
this is only available in php5.

http://ellislab.com/codeigniter/user-gui...ecord.html
#5

[eluser]nebulom[/eluser]
Yes, and I'm with PHP4 so can't use chain methods. Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB