logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 10-21-2012, 02:26 PM   #1
Need Help 26
 
Join Date: Oct 2012
Posts: 1
Default 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:

Business Name
Phone Number
Street Address
Town
County
Website

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)


Code:
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
Could I create a recordset on a seperate page to show results from a certain county? for example Co.Carlow, which has an INT value of 3.

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?
Need Help 26 is offline   Reply With Quote
Old 10-22-2012, 01:14 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

use a url link such as (to page country.php) country.php?country=3

then on the page collect the value
<?php
$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;
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 11-12-2012, 07:04 AM   #3
jmichae3
 
Join Date: Dec 2010
Posts: 366
Default

the 4_get was a typo, it is actually
Code:
$county = $_GET['county'];
which will contain the value from the
Code:
Irelandservicedepts.php?county=3
and country should be changed to county in a few places. you probably already cought it,but in case you didn't, this is what the code was supposed to be.
__________________
------------
Jim Michaels
HTML Code:
improperly<strong>nested<em>elements</strong>cause</em>
browser confusion (I believe the term is 'tag soup')!
jmichae3 is offline   Reply With Quote
Old 11-12-2012, 07:09 AM   #4
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

whoops, good catch
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:45 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com