Using PHP to filter results from an SQL table.

Status
Not open for further replies.

erik7584

Right off the assembly line
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

हॉर्न ओके प्लीज़
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
 
Status
Not open for further replies.
Top Bottom