Welcome Guest, Not a member yet? Register   Sign In
simple & helpful DB class for CI
#1

[eluser]vps4[/eluser]
It’s simple and useful MySQL DB class.
I modify it from WordPress2.5.1 wp-db.php

It also automatic load DB config from CI config file.

Usage:

just put it in your CI app library folder, usually in system/application/libraries
and name Db.php

now , you can load the library anywhere, or set it automatic load in autoload config file
Code:
$this->load->library('db');


these method is better than CI database, only ONE line code.
Code:
$this->db->get_var($sql);
$this->db->get_row($sql);
$this->db->get_col($sql);
$this->db->get_results($sql);


enjoy it!!!

I can’t post the code to here, because it’s so long

please get it from

http://www.21andy.com/blog/20080607/1156.html

anyway, sorry for my poor english.
#2

[eluser]Référencement Google[/eluser]
Only one line of code:
Code:
redirect('out');

No seriously... I am very curious about what is so much better than Active Record, could you give us a technical explanation about it? Is there some better performances? What if I want to make Joined tables? Could it build my database structure automatically pressing 1 button?
#3

[eluser]usmc[/eluser]
I am always interested in magical code. Did a unicorn design this?
#4

[eluser]sikkle[/eluser]
Bah let's be honest, after do a good translation of the topic, that mean, another solution to try to make your life easier with database query.

Give peace a chance Smile
#5

[eluser]Référencement Google[/eluser]
Sorry Sikkle, but I don't like when people pop in a community by saying they have something "better than CI database, only ONE line code"... First he propose his code and ask people what they think about it. And if he real have something better, then explain why and how it is. What he made is a non-respect and that's why he get our magical answers.




Theme © iAndrew 2016 - Forum software by © MyBB