I am getting below error while adding new record in DB
"Couldn't execute query. 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 '(`composition_pk`,`composition_title`) VALUES ('55','This is test')' at line 1 – INSERT INTO (`composition_pk`,`composition_title`) VALUES ('55','This is test')"
I get this error when I display specicific columns & try to insert record.
If I display whole table instead of setting columns, it works fine.
Here is code of columns:
$col = array();
$col["title"] = "composition_pk";
$col["name"] = "composition_pk";
$col["hidden"] = false;
$col["editable"] = true;
$col["autoid"] = true;
$cols[] = $col;
$col = array();
$col["title"] = "composition_title";
$col["name"] = "composition_title";
$col["width"] = "10";
$col["hidden"] = false;
$col["editable"] = true;
$cols[] = $col;
I found similar question by many users, most of the time, it occurs due to user error, but I am unable to point out my error.
Could you please help me.
My problem is solved, it is necessary to set table even if you are using table name in "SELECT" query.
$g->table = "table_name"; (this statement was missing, which was causing problem)
$g->select_command = "SELECT * FROM table_name";
What if it is a multi-table SELECT? Do you just arbitrarily use the first table in the SELECT? Thanks