Welcome Guest, Not a member yet? Register   Sign In
Using an own Class (= Library)
#4

[eluser]LuckyFella73[/eluser]
hi dsentker,

[quote author="dsentker" date="1262571351"]you're right, sounds logical. But how can i prevent the multiple DB Connections (last Q.) ? And where can i place my $this->mydbclass->connect(); ? I don't want to load it manually to every Controller's constructor...[/quote]

There is a file called autoload.php in "system/application/config/" where
you can define the database class to be loaded in every controller.

I recommend you to have a look at the user guide and get a bit more familiar with
CI classes and models otherwise you will and up scripting a lot of stuff that's
allready available! CI has many very useful libraries which are easy to use!

You don't have to care about connecting to your db when using the db class like
you use to do scripting "plain" PHP. Just edit the database.php file ("system/application/config/"),
(auto-)load the db class and do your queries (using models and the active record class - if possible).


Messages In This Thread
Using an own Class (= Library) - by El Forum - 01-03-2010, 02:09 PM
Using an own Class (= Library) - by El Forum - 01-03-2010, 02:10 PM
Using an own Class (= Library) - by El Forum - 01-03-2010, 02:15 PM
Using an own Class (= Library) - by El Forum - 01-04-2010, 07:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB