DIGIT-ARC read-only archive · snapshot: July 23, 2026

Using PHP to filter results from an SQL table.

2 posts · originally from https://geek.digit.in/community/threads/using-php-to-filter-results-from-an-sql-table.102349/

E
erik7584 Original post #1
Nov 18, 2008 at 12:32 AM
Hi Guys,

I am new to php so this problem may be simple for you guys.

I currently have a web page with PHP code that pulls all the information from a mysql database and displays it on the web page. What I would like is to have another page which would filter the results according to which link is clicked.

For example: The database is based on cars. When the user uses the website, they will see a page with all the car manufacturers listed. When the user clicks on one of the manufacturers, it takes them to the next page which has now fitered the results and only shows the records from that particular manufacturer.

I hope my explanation is ok. Your help would be greatly appreciated, I have been playing around with this for ages with no luck.

Thanks
victor_rambo
Nov 18, 2008 at 12:57 AM
Retrieving all rows and then filtering using PHP is a wastage of resources. It will make your site slower than a snail.Instead, use MySQL's power to SELECT only those rows that satisfy a particular condition.

Eg:
Code:
SELECT * FROM cars WHERE manufacturer='Ford';

And I suggest you go through some PHP-MySQL tutorials.I suggest the below site for a beginner's tutorial: *www.freewebmasterhelp.com/tutorials/phpmysql