i am trying to show mysql data in select dropdown in jsgrid.
$('#grid_table').jsGrid({ width: "100%", height: "600px", filtering: true, inserting:true, editing: true, sorting: true, paging: true, autoload: true, pageSize: 10, pageButtonCount: 5, deleteConfirm: "Do you really want to delete data?", controller: { loadData: function(filter){ return $.ajax({ type: "GET", url: "fetch.php", data: filter }); }, insertItem: function(item){ return $.ajax({ type: "POST", url: "fetch.php", data:item }); }, updateItem: function(item){ return $.ajax({ type: "PUT", url: "fetch.php", data: item }); }, }, fields: [ { name: "Module_Id", type: "select", width: 150, validate: "required" }, { name: "Module_Name", type: "text", width: 150, validate: "required" }, { name: "View_Rights", type: "select", items: [ { Name: "", Id: '' }, { Name: "Yes", Id: 'Y' }, { Name: "No", Id: 'N' } ], valueField: "Id", textField: "Name", width: 50, validate: "required" }, { name: "Create_Rights", type: "select", items: [ { Name: "", Id: '' }, { Name: "Yes", Id: 'Y' }, { Name: "No", Id: 'N' } ], valueField: "Id", textField: "Name", width: 50, validate: "required" }, { name: "Modify_Rights", type: "select", items: [ { Name: "", Id: '' }, { Name: "Yes", Id: 'Y' }, { Name: "No", Id: 'N' } ], valueField: "Id", textField: "Name", width: 50, validate: "required" }, { name: "Delete_Rights", type: "select", items: [ { Name: "", Id: '' }, { Name: "Yes", Id: 'Y' }, { Name: "No", Id: 'N' } ], valueField: "Id", textField: "Name", width: 50, validate: "required" }, { name: "Print_Rights", type: "select", items: [ { Name: "", Id: '' }, { Name: "Yes", Id: 'Y' }, { Name: "No", Id: 'N' } ], valueField: "Id", textField: "Name", width: 50, validate: "required" }, { type: "control" } ] }); fetch.php <kbd>if($method == 'GET') { $data = array( ':id' => "%" . $_GET['id'] . "%", ':Module_Name' => "%" . $_GET['Module_Name'] . "%", ':View_Rights' => "%" . $_GET['View_Rights'] . "%", ':Create_Rights' => "%" . $_GET['Create_Rights'] . "%", ':Modify_Rights' => "%" . $_GET['Modify_Rights'] . "%", ':Delete_Rights' => "%" . $_GET['Delete_Rights'] . "%", ':Print_Rights' => "%" . $_GET['Print_Rights'] . "%" ); $query = "SELECT * FROM user_detail WHERE User_Name = :User_Name AND Module_Name LIKE :Module_Name AND View_Rights LIKE :View_Rights AND Create_Rights LIKE :Create_Rights AND Modify_Rights LIKE :Modify_Rights AND Delete_Rights LIKE :Delete_Rights AND Print_Rights LIKE :Print_Rights ORDER BY id DESC"; $statement = $connect->prepare($query); $statement->execute($data); $result = $statement->fetchAll(); foreach($result as $row) { $output[] = array( 'id' => $row['id'], 'User_Name' => $row['User_Name'], 'Module_Id' => $row['Module_Id'], 'Module_Name' => $row['Module_Name'], 'View_Rights' => $row['View_Rights'], 'Create_Rights' => $row['Create_Rights'], 'Modify_Rights' => $row['Modify_Rights'], 'Delete_Rights' => $row['Delete_Rights'], 'Print_Rights' => $row['Print_Rights'] //'Created_On' => date('Y-m-d H:i:s',$row['Created_On']) //'Modified_On' => $row['Modified_On'] ); } header("Content-Type: application/json"); echo json_encode($output); } if($method == "POST") { $data = array( ':Module_Name' => $_POST['Module_Name'], ':View_Rights' => $_POST["View_Rights"], ':Create_Rights' => $_POST["Create_Rights"], ':Modify_Rights' => $_POST["Modify_Rights"], ':Delete_Rights' => $_POST["Delete_Rights"], ':Print_Rights' => $_POST["Print_Rights"], ':Created_On' => date('Y-m-d H:i:s') ); $query = "INSERT INTO user_detail (User_Name,Module_Name, View_Rights, Create_Rights, Modify_Rights,Delete_Rights,Print_Rights,Created_On) VALUES (:User_Name, :Module_Name, :View_Rights, :Create_Rights, :Modify_Rights, :Delete_Rights, :Print_Rights, :Created_On)"; $statement = $connect->prepare($query); $statement->execute($data); } if($method == 'PUT') { parse_str(file_get_contents("php://input"), $_PUT); $data = array( ':id' => $_PUT['id'], ':User_Name' => $_PUT['User_Name'], ':Module_Name' => $_PUT['Module_Name'], ':View_Rights' => $_PUT['View_Rights'], ':Create_Rights' => $_PUT['Create_Rights'], ':Modify_Rights' => $_PUT['Modify_Rights'], ':Delete_Rights' => $_PUT['Delete_Rights'], ':Print_Rights' => $_PUT['Print_Rights'], ':Modified_On' => date('Y-m-d H:i:s') ); $query = " UPDATE user_detail SET Module_Name = :Module_Name, View_Rights = :View_Rights, Create_Rights = :Create_Rights, Modify_Rights = :Modify_Rights, Delete_Rights = :Delete_Rights, Print_Rights = :Print_Rights, Modified_On = :Modified_On WHERE id = :id AND User_Name = :User_Name "; $statement = $connect->prepare($query); $statement->execute($data); } Appreciate anyone help me with the codings