Welcome Guest, Not a member yet? Register   Sign In
Count selected data
#1

[eluser]rochellecanale[/eluser]
Hey guys i just want to know how can i convert this code to active record.

Code:
$payment = 'CASH';
$sql = "SELECT COUNT(*) FROM sales WHERE payment = $payment";
#2

[eluser]LuckyFella73[/eluser]
Codeigniter Userguide:

Code:
$this->db->like('title', 'match'); // where(), or_where(), like(), or_like(), etc.
$this->db->from('my_table');
echo $this->db->count_all_results();

Don't forget to look at the user guide. Most the time you get your answer much faster Wink
#3

[eluser]rochellecanale[/eluser]
thanks you.




Theme © iAndrew 2016 - Forum software by © MyBB