Welcome Guest, Not a member yet? Register   Sign In
problem with some mysql constat
#7

[eluser]kjackson7_93[/eluser]
Thanks a ton! It was the get() without passing a database that I was stumped on... this is how I used it in my application:

Code:
function getNotes($offset=0,$row_count=$this->default_page_count){
        $this->db->select("SQL_CALC_FOUND_ROWS board_notes.*");
        $this->db->orderby('board_notes.created', 'desc');
        $this->db->limit($row_count,$offset);
        $board_notes = $this->db->get('board_notes');
        
        $this->db->select("FOUND_ROWS() as PostNum");
        $rRes2 = $this->db->get();
        $iPostNum = $rRes2->row_array();
        $this->_setFoundRows($iPostNum['PostNum']);

        return $board_notes->result();
    }
    
    function _setFoundRows($found_rows){
        $this->FoundRows = $found_rows;
    }
    
    function getFoundRows(){
        return $this->FoundRows;
    }

Then in my controller:
Code:
$notes['offset'] = (int) $this->uri->segment(3, 0);
$notes['notes_list'] = $this->Notes_model->getNotes($notes['offset'], $paging['per_page']);
$notes['found_rows'] = $this->Notes_model->getFoundRows();

Thanks again!


Messages In This Thread
problem with some mysql constat - by El Forum - 02-02-2008, 02:50 PM
problem with some mysql constat - by El Forum - 02-02-2008, 04:44 PM
problem with some mysql constat - by El Forum - 02-02-2008, 05:28 PM
problem with some mysql constat - by El Forum - 02-02-2008, 11:54 PM
problem with some mysql constat - by El Forum - 03-04-2008, 01:44 PM
problem with some mysql constat - by El Forum - 03-04-2008, 10:59 PM
problem with some mysql constat - by El Forum - 03-05-2008, 11:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB