table named ‘table’ doesn’t work |
|||
|---|---|---|---|
| Date: | 05/06/2008 | Severity: | Trivial |
| Status: | Resolved | Reporter: | yoda.pt |
| Version: | 1.6.1 | ||
| Keywords: | Scaffolding | ||
Description
When using an mysql table called ‘table’, it outputs several mysql warnings, perhaps due to confusion with ‘TABLE’ syntax. This issue can be fixed by querying with the right characters, like ‘`’.
Code Sample
class Blog extends Controller
{
function Blog()
{
parent::Controller();
$this->load->scaffolding('table');
}
Expected Result
Normal behaviour when performing :
http://127.0.0.1/CodeIgniter/index.php/blog/scaffolding/add
Actual Result
An Error Was Encountered
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 ‘table LIMIT 1’ at line 1
SELECT * FROM table LIMIT 1
Comment on Bug Report
| Posted by: inparo on 6 May 2008 9:47am | |
|
|
This can also be avoided by prepending the dbname (i.e. mydb.table ). Side-note: table is a reserved word. Using it is definitely NOT a good idea. Use a table prefix to avoid future compatibility issues. |
| Posted by: Derek Jones on 12 May 2008 10:14am | |
|
|
As scaffolding was deprecated in 1.6.0, I apologize, but that code is on longer being maintained, and will not remain in the codebase for many more releases. It is currently there only to provide developers time to move away from application code that relies on Scaffolding while allowing them to continue to stay up to date with the rest of the application. |
