Search Just stopped working

QuestionsSearch Just stopped working
Rheal asked 3 years ago

I have a search field , when I enter something in it the Loading Icon appears but it does not return the search.
Anyone have any thoughts?

Partial Code listed below.

$g = new jqgrid($db_conf);

$grid["caption"] = "Pending Request";
$grid["autowidth"] = true;
$grid["multiselect"] = true; // allow you to multi-select through checkboxes
// fill external form on select row
$grid["onSelectRow"] = "function(){ load_form(); }";
$grid["bulkedit_options"]["afterShowForm"] = "function(){ }"; // js callback for bulk edit form dialog
$grid["sortname"] = 'Course_Code'; // by default sort grid by this field
$grid["sortorder"] = "asc"; // ASC or DESC
$grid["rowNum"] = 100; // by default 20

$g->set_actions(array(
"bulkedit"=>true,
"add"=>true, // allow/disallow add
"edit"=>true, // allow/disallow edit
"delete"=>false, // allow/disallow delete
"export_excel"=>true, // export excel button
"export_pdf"=>true, // export pdf button
"export_csv"=>false, // export csv button
"search" => "advance" // show single/multi field search condition (e.g. simple or advance)

)
);

$g->select_command ="SELECT * FROM [v_Request_Pending] WHERE [Prime_Instructor1] ='".$_SESSION['s3']."' OR [Second_Instructor1] ='".$_SESSION['s3']."'";

$g->table = "Request";

$grid["height"] = "100";
$grid["autowidth"] = false;
$grid["resizable"] = true;

$col = array();
$col["title"] = "Request_ID";
$col["name"] = "Request_ID";
$col["width"] = "5";
$col["hidden"] = false;
$col["editable"] = false;
$col["align"] = "left";
$col["search"] = false;
$cols[] = $col;

$col = array();
$col["title"] = "Received";
$col["name"] = "Request_Received";
$col["width"] = "5";
$col["formatter"] = "date";
$col["formatoptions"] = array("srcformat"=>'Y-m-d',"newformat"=>'d/m/Y');
$col["editable"] = false;
$col["align"] = "left";
$col["search"] = false;
$cols[] = $col;

$col = array();
$col["title"] = "Course No";
$col["name"] = "Course_Code";
$col["width"] = "5";
$col["editable"] = false;
$col["align"] = "left";
$col["search"] = true;
$cols[] = $col;

3 Answers
Rheal answered 3 years ago

I think I found the Problem.
It doesn't like my sql query.
I remove the Where Clause and the search works.

Is there a way I can still keep the Where clause in my query and have the search work?

$g->select_command ="SELECT * FROM [v_Request_Pending] WHERE [Prime_Instructor1] ='".$_SESSION['s3']."' OR [Second_Instructor1] ='".$_SESSION['s3']."'";

Rheal answered 3 years ago

I have figured it out and got it working.

I needed to put the Where Clause within Brackets.

WHERE ([Prime_Instructor1] ='".$_SESSION['s3']."' OR [Second_Instructor1] ='".$_SESSION['s3']."')";

Abu Ghufran answered 3 years ago

Thanks for updating.

Your Answer

16 + 9 =

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 / 5. Vote count:

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

Let us improve this post!