|
|
|
|
Thread title: Display Database results |
|
|
|
|
|
Thread tools
Search this thread
Display Modes
|
|
01-16-2012, 06:51 AM
|
#1
|
Status: I'm new around here
Join date: Feb 2011
Location: Joplin, MO, USA
Expertise: Design & Building basic sites
Software: DreamWeaver, Photoshop, FileZi
Posts: 9
|
Display Database results
I am setting up a website for a friend who started a program to keep medical information in folders where Emergency Workers can find them easily. She has mailed fliers to EMS and Fire agencies throughout several states and they have started confirming receipt of them via an email form on the website. She has expressed the desire to have the form automatically populate the pages where the confirmed agencies will be listed. I have already rebuilt the form so that it will insert the results into the database for us, now I am trying to build the page to display the results. She wants a separate page for each state so I need the query to be specific to a certain field. The form/database collects Agency Names, Address, City, State, Zip, Phone, Email, County Served, etc...
The only results we want displayed on the page is the County Served and Agency Name. I have found some guides on building searches as well as displaying all the results but can anyone offer any advice on how to get the page to only display the results where the field "State" is Missouri and sort those results by the field "County", then only display "County" and "AgencyName"?
Just for reference, I am using PHP and MySQL
I have been stuck on this for a couple of days so any help anyone can offer is greatly appreciated.
Thanks!!!
|
|
01-16-2012, 07:03 AM
|
#2
|
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
Posts: 6,894
|
To provide any sort of assistance I'd have to see your database structure. It should be as simple as SELECT information,county,state FROM table WHERE state='state' ORDER BY county.
|
|
01-16-2012, 07:31 AM
|
#3
|
Status: I'm new around here
Join date: Feb 2011
Location: Joplin, MO, USA
Expertise: Design & Building basic sites
Software: DreamWeaver, Photoshop, FileZi
Posts: 9
|
Here is a screenshot of the database. Hopefully this will give you the structure info you mentioned.
|
|
01-16-2012, 05:43 PM
|
#4
|
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
Posts: 6,894
|
It should be a simple select statement since its all on one table. Try something like the following:
Code:
SELECT [information],state,county FROM EMIO_Agency_Column WHERE state='state' AND county='county'
where [information] are the other columns you want to pull.
This is a very simple query you're needing help with, should you really be pulling medical records? Are you familiar with SQL injection?
|
|
01-16-2012, 09:36 PM
|
#5
|
Status: I'm new around here
Join date: Feb 2011
Location: Joplin, MO, USA
Expertise: Design & Building basic sites
Software: DreamWeaver, Photoshop, FileZi
Posts: 9
|
Thanks for you help!!
You are correct about this being really simple. I have done it before but I was drawing a huge blank this time around and was having problems finding the solution to get it to filter by state then county.
As far as the SQL Injection and medical records, no worries there. This system does not actually contain any medical records of any type. My friend supplies a form that people keep in their car or home in bright envelopes so in case of an emergency, first responders can the victims vital information quickly. The database simply keeps track of what emergency service agencies have been advised of the program.
Thanks again for your help!!
|
|
|
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
|