SQL select with php variable

wxdqz

New Member
okay, so i'm using mysql and php. I have a database. Lets say it has statenames, contact person,links, notes and topics.

i have a php page where you can select a state from a dropdown box (lets say it's name is statename). I want to be able to retrieve all the info based on that state..

so for example, if someone chooses Maryland, it will display all the records that contain maryland, so it would be like

Maryland, John Doe, <!-- m --><a class="postlink" href="http://url.com">http://url.com</a><!-- m -->, notes go here, topic goes here
Maryland, Jane Doe, blah, blah, blah , blah
Maryland, and so on, and so on

What sort of SQL statement would I need to use for this? I thought something like

SELECT * FROM statedata WHERE '$statename' = state

might work..but it doesn't.
 
Back
Top