Error

QuestionsError
Abdul Ahad asked 3 months ago

I get this error when I save a record in the grid:

Couldn’t execute query. You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘WHERE `CardNo` IN (’57’)’ at line 1 – SELECT * FROM WHERE `CardNo` IN (’57’).

The complete source is as follows:

// set few params
$opt[“caption”] = “People”;
$g->set_options($opt);
// set database table for CRUD operations
// $g->table = “select CardNo,Fullname,Address,Phone from people”;
// query based
 $g->select_command =”select CardNo,Fullname,Address,Phone from people”;
$col = array();
$col[“title”] = “Card No”; // caption of column, can use HTML tags too
$col[“name”] = “CardNo”; // grid column name, same as db field or alias from sql
$col[“width”] = “10”; // width on grid
$col[“editable”] = false;
$cols[] = $col;
$col = array();
$col[“title”] = “Name”; // caption of column, can use HTML tags too
$col[“name”] = “Fullname”; // grid column name, same as db field or alias from sql
$col[“width”] = “50”; // width on grid
$col[“editable”] = true;
$cols[] = $col;
$col = array();
$col[“title”] = “Address”; // caption of column, can use HTML tags too
$col[“name”] = “Address”; // grid column name, same as db field or alias from sql
$col[“width”] = “50”; // width on grid
$col[“editable”] = true;
$cols[] = $col;
$col = array();
$col[“title”] = “Phone”; // caption of column, can use HTML tags too
$col[“name”] = “Phone”; // grid column name, same as db field or alias from sql
$col[“width”] = “10”; // width on grid
$col[“editable”] = true;
$cols[] = $col;
// pass the cooked columns to grid
$g->set_columns($cols);
// render grid and get html/js output
$out = $g->render(“list1”);

2 Answers
Abu answered 3 months ago

You need to specify the table property along with select_command to enable the modification operations.

Abdul Ahad answered 3 months ago

Thank you. it worked

Your Answer

9 + 17 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?