Filter Results

QuestionsFilter Results
Chris asked 3 years ago

Hey,
I would like to exclude some results always. In SQL I would just add “WHERE column != value”, but I cant do this here.
How would I go about doing this? These results should ALWAYS be excluded no matter the search a user runs.
 

Chris replied 3 years ago

Following on from this, it would be handy to understand if it is possible to have a way to use a session (so a login system sitting in front of this) that when someone logs in, they can see a further filtered list.

e.g. User1 logs in and only sees results where the User column equals “User1”

1 Answers
Abu Ghufran Staff answered 3 years ago

You can specify select_command (sql statement) and put WHERE clause in it. It will always remain in effect along with other grid filters. 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 c.gender = ‘male'”;

You can use session variable in sql query in same way. e.g.

$g->select_command = “SELECT i.id, invdate, i.note, i.total, i.closed FROM invheader i
WHERE i.client_id = “.intval($_SESSION[“uid”]);

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Chris replied 3 years ago

Thanks for the help, I am so annoyed that I did try just this earlier but it didnt work for me.

Thanks again for the support

Your Answer

10 + 18 =

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?