[eluser]rochellecanale[/eluser]
hey guys i just want to ask what can i do to return the number of rows in my mysql tables?
ive got an error when i used $query->num_rows(); not actually an error but it returned to '1'? here's my code hope you can help me.
my view
Code:
<tr>
<td><?php echo "Total Records: ".$totalsales ?></td>
</tr>
my model function
Code:
public function countTotalSalesRecord(){
$query = $this->db->query("SELECT COUNT(*) FROM tbl_membership_sales");
return $query;
}
my controller
Code:
public function viewMemberSales(){
$data['memsales'] = $this->sales_model->getAllMembershipSales();
$data['totalsales'] = $this->sales_model->countTotalSalesRecord();
$this->load->view('sites/membershipsales',$data);
}
===========================================================================================
it results to
Total Records: 1