Can I use ezSQL with codeigniter? |
[eluser]jv2222[/eluser]
Hi, Is it possible to use ezSQL with codeigniter rather than the built in database class? What would be the best way to do this? Cheers, Justin (ezSQL author)
[eluser]jv2222[/eluser]
Just a quick note to say I've ported ezSQL to work with native codeigniter functions. So, basically it means you can use ezSQL as you are used to working with it, but it uses the default codeigniter connectors to access the DB. You can get it here: http://ezsql.jvmultimedia.com/ Once installed you can use like so in your controller functions... Code: function index() Hope someone finds it useful! Cheers, Justin
[eluser]cjoy[/eluser]
great to see that ezSQL is available on CI as well - much prefer this over the alternatives. however, I cant seem to get it to work... Fatal error: Call to undefined method ezSQL_codeigniter::timer_start() in /application/libraries/Ezsql_codeigniter.php on line 47 the library and helper are being autoloaded and it doesnt matter wether I use global $db-> or $this->ezsql-> anyone managed to get ezSQL working?
[eluser]jv2222[/eluser]
I have it working. The error is because you don't have the ez_sql_core.php loaded (which ezsql_mysql extends). Code: Rename: ez_sql_core.php and move to application\helpers\ez_sql_core_helper.php Then, in application\config\autoload.php Code: $autoload['helper'] = array('ez_sql_core'); Hope this helps!
[eluser]cjoy[/eluser]
[quote author="jv2222" date="1269126637"]I have it working. The error is because you don't have the ez_sql_core.php loaded (which ezsql_mysql extends). Code: Rename: ez_sql_core.php and move to application\helpers\ez_sql_core_helper.php Then, in application\config\autoload.php Code: $autoload['helper'] = array('ez_sql_core'); Hope this helps![/quote] tripple checked this. I have both, the library and the helper, loaded (PHP 5.26). As far as I can tell the install matches your instructions that come bundled with the ci-class.
[eluser]jv2222[/eluser]
Well, what can I say The error is because the core is not loaded! By rights you should also be getting another error/warning saying that the core is missing and there is an error trying to extend on top of it...
[eluser]cjoy[/eluser]
[quote author="jv2222" date="1270127093"]Well, what can I say The error is because the core is not loaded! By rights you should also be getting another error/warning saying that the core is missing and there is an error trying to extend on top of it...[/quote] since I am really desperate to get ezSQL working in CI - let me warm up this topic again. the core is loaded - i tripple checked that. Files moved: Quote:/helpers/ez_sql_core_helper.php Autoload entries: Code: $autoload['libraries'] = array('session','database','ezsql_codeigniter'); Controller: Code: class Main extends Controller { the error I get: Quote:Fatal error: Call to undefined method ezSQL_codeigniter::timer_start() in /Applications/MAMP/htdocs/tdict/system/application/libraries/Ezsql_codeigniter.php on line 47 Looking at the library and helper, there is no trace of a timer_start() metho, other then the call on line 47. any help is appreciated! edit: stripped all the timer related lines from EZsql_codeigniter.php - now all ezSQL calls function as expected. *sigh* |
Welcome Guest, Not a member yet? Register Sign In |