Welcome Guest, Not a member yet? Register   Sign In
How to use SQL_CALC_FOUND_ROWS function on active record with select method
#1

I know we can use SQL_CALC_FOUND_ROWS  and FOUND_ROWS() like

PHP Code:
$this->db->select('SQL_CALC_FOUND_ROWS *'false);

// And get the result
$query $this->db->query('SELECT FOUND_ROWS() AS `count`');
$totalRows $query->row()->count

But if we want to select the column by our own like

PHP Code:
$this->db->select('SQL_CALC_FOUND_ROWS *'false);
$this->db->select('a.name, b.age'); 

This will work but come out the sql string like "SELECT SQL_CALC_FOUND_ROWS *, `a`.`name`, `b`.`age`", actually get everything from table a and table b, how to make it like "SELECT SQL_CALC_FOUND_ROWS `a`.`name`, `b`.`age`"
Reply


Messages In This Thread
How to use SQL_CALC_FOUND_ROWS function on active record with select method - by chan15 - 04-14-2016, 08:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB