Passing query from session

QuestionsPassing query from session
Stephen Hartigan asked 6 years ago

Hi Abu,

I have a query stored in a PHP session like this:
$_SESSION[“qry1”] = ’ AND LOWER(`master`.` Centre_Code`) LIKE LOWER('%h67%')’

The querys are stored in a table as favourite searches. When the user selects one the query detail is moved to the PHP session

I would like to be able to update my ‘master’ table by passing the session value query. Is there an easy way to achieve this.

Thanks in advance,

Stephen

3 Answers
Abu Ghufran answered 6 years ago

Hello,

As far as i understand your question, you can append this session variable next to select_command. For e.g.

$g->select_command = "SELECT i.id, invdate , c.name,
i.note, i.total, i.closed FROM invheader i
INNER JOIN clients c ON c.client_id = i.client_id WHERE 1=1".$_SESSION[“qry1”];

You may also need to refresh grid using javascript code

jQuery('#list1').trigger("reloadGrid",[{jqgrid_page:1}]);
(where list1 is grid id)

You can also reload whole page as per requirement.

Andreas Ek answered 6 years ago

Should the "reloadGrid" work on arrays as well?

Abu Ghufran answered 6 years ago

Hello Andreas,

Currently it does not work on the grid with array as datasource.
All operations on that grid are performed on clientside.

Your Answer

6 + 18 =

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:

As you found this post useful...

Follow us on social media!

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

Let us improve this post!