Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Filter a business directory database

  • 21-10-2012 2:37pm
    #1
    Registered Users, Registered Users 2 Posts: 173 ✭✭


    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. (excuse the design - work to do on that!)

    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.

    8108767095_450ac5f24e_b.jpg


    I have the database in phpmyadmin as follows:

    8095141501_86d1fc6523_b.jpg


    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
    
    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? :)


Comments

  • Registered Users, Registered Users 2 Posts: 7,501 ✭✭✭BrokenArrows


    Just add a WHERE condition at the end of your current SQL
    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
    [B]WHERE otblcounty.countyname = 3[/B]
    
    
    
    


  • Registered Users, Registered Users 2 Posts: 173 ✭✭Not a person


    Just add a WHERE condition at the end of your current SQL
    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
    [B]WHERE otblcounty.countyname = 3[/B]
    
    
    
    

    Thanks,

    It worked with adding
    WHERE otblcounty.countyid = 3
    

    Much appreciated!


Advertisement