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

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());
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.