Welcome Guest, Not a member yet? Register   Sign In
[question - solved] Join - active record
#6

[eluser]awpti[/eluser]
One thing I do in my models:

$this->db->.....

$data = $this->db->get('table');

return $data->result();

No sense in returning the result object when you can just return the data and start manipulating it right off the bat.

Example:

Code:
function countup($link_id) {
        $this->db->query('UPDATE awLinks SET link_clicks = (link_clicks + 1) WHERE link_id = '.$link_id);
        $this->db->select('link_url')->where('link_id', $link_id);
        $link = $this->db->get('awLinks');
        return ($link->num_rows() > 0) ? $link->row() : FALSE;
    }


Messages In This Thread
[question - solved] Join - active record - by El Forum - 08-07-2007, 03:16 PM
[question - solved] Join - active record - by El Forum - 08-07-2007, 04:07 PM
[question - solved] Join - active record - by El Forum - 08-07-2007, 04:16 PM
[question - solved] Join - active record - by El Forum - 08-07-2007, 04:36 PM
[question - solved] Join - active record - by El Forum - 08-07-2007, 06:23 PM
[question - solved] Join - active record - by El Forum - 08-08-2007, 12:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB