0

hello,
i have a php/mysql vehicle database with fields make, model, price and year. in my webpage ALL database records are displayed by default using the select command in a table.

i would like add a filtering functionality on all 4 fields as such i have an arrow selector on each field which when clicked e.g on field make displays all car makes then a user again clicks on a particular make (e.g toyota) the table data recreates to show toyotas only while simultaneously updating the all the other fields' records.

the filters in the other fields e.g price should also simultaneously update ALL fields.
help appreciated greatly

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Will Gresham
0

You will need to make slight alterations to your SELECT statement for each query to get the desired results. So when the link is clicked the selected options will need to be passed to PHP (using Session data, POST, Query String etc)

To select only 1 value from a column, use a WHERE in your query: e.g.

mysql_query("SELECT * FROM `cars` WHERE `make` = 'some_value'")or die(mysql_error());

By arrow selector I assume you mean sort ascending/descending? If so, use ORDER:e.g.

mysql_query("SELECT * FROM `cars` WHERE `make` = 'some_value' ORDER BY `price` ASC")or die(mysql_error());
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.