Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1048 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

Display Database results

Thread title: Display Database results
Reply    
    Thread tools Search this thread Display Modes  
01-16-2012, 06:51 AM
#1
jasonladue is offline jasonladue
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
iTrader: 0 / 0%
 

jasonladue is on a distinguished road

  Old  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
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,894
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old

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.

Reply With Quote
01-16-2012, 07:31 AM
#3
jasonladue is offline jasonladue
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
iTrader: 0 / 0%
 

jasonladue is on a distinguished road

  Old

Here is a screenshot of the database. Hopefully this will give you the structure info you mentioned.

Reply With Quote
01-16-2012, 05:43 PM
#4
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,894
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old

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?

Thanked by:
jasonladue (01-17-2012)
01-16-2012, 09:36 PM
#5
jasonladue is offline jasonladue
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
iTrader: 0 / 0%
 

jasonladue is on a distinguished road

  Old

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!!

Reply With Quote
Reply    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed