Welcome Guest, Not a member yet? Register   Sign In
Changes to the MySQL class?
#1

[eluser]Leggy[/eluser]
Well I'm working on the new version of this site and i've used one of the old queries from the old version, I am using CodeIgniter and I have made a libary for the IPB SDK which just really includes it and does it's config and I can use it via $this->ipb->sdk...

The mysql function I want to use is
Code:
SELECT * FROM `ibf_topics` as `t` LEFT JOIN `ibf_posts` as `p` ON (t.topic_firstpost = p.pid) WHERE `approved` = '1' AND `forum_id` = '2' ORDER BY `start_date`
I can do all this with the CodeIgniter functions except the beginning bit: `ibf_topics` as `t` I can't find a way of doing this with CI. I've looked through the CI database class and I don't fully understand it all as I haven't studied how CI works but could someone edit the from function in system/database/DB_active_rec.php so it can do something like $this->db->from( 'ipb_topics', 't' ) and get `ipb_topics` as `t`

Thanks in advanced,
Henry

Forgot to mention this is my current code using the code igniter functions:
Code:
$this->db->join( 'ipf_posts as `p`', '(t.topic_firstpost = p.pid)', 'left' );
$this->db->where( array( 'approved' => 1, 'forum_id' => 2 ) );
$this->db->order_by( 'start_date', 'desc' );
$this->db->from( '`ibf_topics` as `t`' );

$query = $this->db->get();


Messages In This Thread
Changes to the MySQL class? - by El Forum - 06-21-2008, 12:47 PM
Changes to the MySQL class? - by El Forum - 06-21-2008, 04:46 PM
Changes to the MySQL class? - by El Forum - 06-22-2008, 04:08 AM



Theme © iAndrew 2016 - Forum software by © MyBB