Home News Contact Us Forum About Us Demos Products F.A.Q.
Shopping Cart
You currently have 0 items in your cart.


Recent Events
  • 31/12/2023 New Year SALE

    We are glad to announce New Year SALE. 25% discount for all our extensions. Use NY24 coupon code. Hurry up the discount is valid till 7 January.

  • 21/11/2023 BLACK FRIDAY 23 is coming

    BIG SALE, 35% discount for all our extensions. Use BF23 coupon code. Hurry up the discount is valid till 27 November.


2Checkout.com, Inc. is an authorized retailer of goods and services provided by ARI Soft. 2CheckOut




Follow us on twitter



Welcome, Guest
Please Login or Register.    Lost Password?

Filter data table based on user input
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Filter data table based on user input
#19825
Filter data table based on user input 12 Years, 9 Months ago Karma: 0
Hi,

Is there a possibility to use a php generated SQL query as input for a ARI data-table? I want to filter the data-table based on user input. For instance filter a column in a table based on a minimum numeric value provided by a user. I read some other topics on this forum on the same topic, but I couldn't get a solution for this problem.

Many thanks in advance.
The administrator has disabled public write access.
 
#19826
Re:Filter data table based on user input 12 Years, 9 Months ago Karma: 748
Hello,

"ARI Data Tables" supports ability to use request variables in SQL query. For example you can embed "ARI Data Tables" module into an article and add the next HTML code to add filter (for example by "price" column in "products" table):

Code:


<form method="post">
Min price: <input type="text" size="10" name="dtMinPrice" />
<br/><br/>
<input type="submit" value="Search" />
</form>



and use the next SQL query:

Code:


SELECT
 *
FROM
 products
WHERE
 price > {$REQUEST:dtMinPrice}



Regards,
ARI Soft
The administrator has disabled public write access.
 
#19827
Re:Filter data table based on user input 12 Years, 9 Months ago Karma: 0
Great, thanks a lot!
The administrator has disabled public write access.
 
#42265
Re:Filter data table based on user input 11 Years ago Karma: 0
This post is very helpful but I have been experiencing some problem with SQL code.
The html code I have written is:
<form method="post">College: <input type="text" name="collegeFilter" size="20" /> <br /><br /> <input type="submit" value="Search" /></form>
In my SQL code, I got a constraint like:
a.value LIKE '%{$REQUEST:collegeFilter}%'

But when I submit the input, there is a warning "array_flip() expects parameter 1 to be array;array_keys() expects parameter 1 to be array, null given in..."

I think the SQL code could be wrong. Could you please give me some hints? Thank you!
The administrator has disabled public write access.
 
#42266
Re:Filter data table based on user input 11 Years ago Karma: 748
Do you show a table or a graph? Could you send screenshots of module settings page by email?

PS: Use CONCAT('%', {$REQUEST:collegeFilter}, '%') instead of '%{$REQUEST:collegeFilter}%'

Regards,
ARI Soft
The administrator has disabled public write access.
 
Go to topPage: 1