Adding WHERE filter to server_processing.php
Adding WHERE filter to server_processing.php
I'm fairly new to datatables and have been having some issues getting things to work and finding an answer, so I wanted to post a solution to an issue I was having in the hopes it will save someone some time.
I had a column in my DB that set the status of a row. If the status was 1, it was not to appear, set to 2 it was. So a simple
[code]AND WHERE status = '2'[/code]
in the query would have given me the correct results.
After reading numerous post about this, I found that changing this
[code]$sWhere = " "; [/code]
to this
[code]$sWhere = "WHERE status = '2'";[/code]
did the trick.
I did not need to add in anywhere else in the building of the query. I had tried "$sWhere = "status = '2'";" and also $sWhere = "AND status = '2'";" along with adding the filter to other areas further in the section, but they did not work.
Hopefully this will help someone else. Allen & others, if there is a better solution, I would love to see it.
Thank you for your fantastic product.
Gary
I had a column in my DB that set the status of a row. If the status was 1, it was not to appear, set to 2 it was. So a simple
[code]AND WHERE status = '2'[/code]
in the query would have given me the correct results.
After reading numerous post about this, I found that changing this
[code]$sWhere = " "; [/code]
to this
[code]$sWhere = "WHERE status = '2'";[/code]
did the trick.
I did not need to add in anywhere else in the building of the query. I had tried "$sWhere = "status = '2'";" and also $sWhere = "AND status = '2'";" along with adding the filter to other areas further in the section, but they did not work.
Hopefully this will help someone else. Allen & others, if there is a better solution, I would love to see it.
Thank you for your fantastic product.
Gary
This discussion has been closed.