|10-21-2012, 02:26 PM||#1|
Join Date: Oct 2012
Filter a Business Directory Database
Hey, I am a student; my knowledge is limited.. so if this seems too simple apologies in advance..
I am creating a business directory with the following headings which the user will see:
Which displays on my page fine as per the screenshot below.
What i want to do is to filter the database to show only results for a certain county. I want the user to be able to click on a county in the map which will result in the user viewing only business`s who are located in that county.
I know how to create links on the image using the hotspot tool; thats not a problem.
The problem is only showing results from a certain county.
I have the database in phpmyadmin as follows:
In dreamweaver I created a recordset to display the data using the following SQL Code (generated in Access)
SELECT tblcarservicedirectory.businessid, tblcarservicedirectory.businessname, tblcarservicedirectory.businessphonenumber, tblcarservicedirectory.businessaddress, tblcarservicedirectory.businesswebsitehyperlink, tblcarservicedirectory.businesswebsitetext, otbltown.townname, otblcounty.countyname FROM otbltown INNER JOIN (otblcounty INNER JOIN tblcarservicedirectory ON otblcounty.countyid = tblcarservicedirectory.businesscounty) ON otbltown.townid = tblcarservicedirectory.businesstown
What would i need to do to the SQL code above to achieve this?
Alternatively I could link to within the recordset on the same page to direct the user to the section relevant to their county?
Thanks for any tips or advice?
|10-22-2012, 01:14 AM||#2|
Join Date: Aug 2005
use a url link such as (to page country.php) country.php?country=3
then on the page collect the value
$country = 4_GET=['country'];
select * from
FROM otbltown INNER JOIN (otblcounty INNER JOIN tblcarservicedirectory ON
otblcounty.countyid = tblcarservicedirectory.businesscounty) ON
otbltown.townid = tblcarservicedirectory.businesstown
WHERE businesscounty =$country;
|11-12-2012, 07:04 AM||#3|
Join Date: Dec 2010
the 4_get was a typo, it is actually
$county = $_GET['county'];
improperly<strong>nested<em>elements</strong>cause</em> browser confusion (I believe the term is 'tag soup')!