Is it possible to connect to a database manually, using any set of drivers for php, in CodeIgniter? Would I just open a connection in the model? I have a need that CodeIgniter won’t cover but I’d like to use it for it’s MVC architecture. I just can’t use it’s ActiveRecord like in the demos with MySQL, etc.
If I can just do a “regular” non-CodeIgniter database connection, how do I get the information into my controller?
Also, am I wrong for wanting to use CodeIgniter in this way (no active record) but for all its other “stuff”?
Thank you.
This is a very simple example of using functional php to connect to a mysql db. It comes form the php manual. Put this in your model. Call it by calling a model function the normal CI way. It will return the result array, so assign the model call to a variable in your controller.
You can use this in your model method. Let’s assume you return the results
EDIT: moved mysql_close above return statement