[quote name='slav123' timestamp='1336951445' post='1730']
and another small change required:
$select = "`{$this->table_name}`.*";
in line 52 [color=#000000][size=2]grocery_crud_model[/size][/color][color=#666600][size=2].[/size][/color][color=#000000][size=2]php[/size][/color]
in general this changes should be included in source code to avoid this kind of problems with table names...
[/quote]
I'm using a table prefix of 'sdb_' configured in codeignitor's configuration and this has been working fine until I tried the latest snapshot on github - this update breaks the SQL query and I get a SQL syntax error:
[i]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 '.*, (SELECT GROUP_CONCAT(DISTINCT sdb_boroughs.name) FROM sdb_boroughs LEFT JOIN' at line 1[/i]
[i]SELECT sdb_`sdb_records`.*, (SELECT GROUP_CONCAT(DISTINCT sdb_boroughs.name) FROM sdb_boroughs LEFT JOIN sdb_link_record_borough ON sdb_link_record_borough.borough_id = sdb_boroughs.id WHERE sdb_link_record_borough.record_id = `sdb_records`.id GROUP BY sdb_link_record_borough.record_id) AS borough, (SELECT GROUP_CONCAT(DISTINCT sdb_service_categories.name) FROM sdb_service_categories LEFT JOIN sdb_link_record_service_category ON sdb_link_record_service_category.category_id = sdb_service_categories.id WHERE sdb_link_record_service_category.record_id = `sdb_records`.id GROUP BY sdb_link_record_service_category.record_id) AS service_category FROM (`sdb_records`) LIMIT 25[/i]
Reverting line 52 back to;
$select = "{$this->table_name}.*";
..fixes this error. I'm not sure why but it seems to be adding the prefix on twice. But it wasn't before using ` quotes.
I'm defining my tables like this:
$this->crud->set_table($this->db->dbprefix('records'));
Just thought I should let you know!
Cheers.