Open TheDarkITA opened 12 years ago
it is possible that GC has included the prefix automatically. have you tried this?
$crud->set_table('config');
Yes, generate this error:
Error Number: 1146
Table 'thedarkita_db1.config' doesn't exist
SHOW COLUMNS FROM config
will it ever done ? :)
I too an getting this error.. Using
$crud->set_table('bf_schedule');
gives me:
A Database Error Occurred
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.* FROM (`bf_schedule`)' at line 1
SELECT bf_`bf_schedule`.* FROM (`bf_schedule`)
Filename: /home/sitename/prod/models/grocery_crud_model.php
Line Number: 87
I was having the same issue. Ci is adding db prefix automatically and I come up with a quick hack to get it working without trowing these errors.
in grocery crud model constructor add
$this->db->set_dbprefix('');
this will clear prefix that CI uses for all grocery crud db functions, but you will have to add prefix manually in your controller. e.g. $crud->set_table('prefix_table');
@kaerte thanks, had to use this method too.
If the problem is CodeIgniter dbprefix management, why not to focus on that part? I've found the code where CI3 concat the dbprefix with the user query string, and i've been able to patch it. You can find it here: https://github.com/Nihilistik/Grocery_CRUD-CodeIgniter-dbprefix-bug
Maybe it's not the best way to do this, and i've not tested in every possible way, but for basic operations, this works form me. I'll will update as i find new issues.
$crud->set_table('tdi_config');
Generate this error:
Query failed: Unknown table 'tdi_tdi_config' Actual query: SELECT tdi_tdi_config.* FROM (tdi_config) LIMIT 25