Ok, so I think you misunderstood what Piranha was saying.
So,
Suppose you have a contact table of your users identity, and that you have other tables where you store additional information about the user. Those additional tables might store other things like user login info. More to the point those other tables might store things you need multiple records for.
For instance if you are doing a website about people's cars, some of them are going to have one car and some of them are going to have dozens. You don't want to make dozens of fields just for the cars in your contact record, you want to have a table that stores the contacts_ID, and a car record. Then you loop through the car table for every car that is associated to that contact by something like car_ref_contact_ID.
So,
SELECT
contact.contacts_ID,
contact.last_name,
contact.contacts_ID,
cars.cars_ref_contacts_ID
FROM contacts
LEFT JOIN cars ON
cars.cars_ref_contacts_ID = contacts.contacts_ID
WHERE ( contacts.contacts_ID = $who you are looking for)
ORDER by contacts.last_name asc;
If you have recovered the contacts ID already (like you are going to there view page, then simplfy to
--------- Seelct * means get everything ---------
SELECT *
FROM cars
WHERE ( cars.cars_ref_contacts_ID = $who you are looking for)
ORDER by contacts.last_name asc;
So,
what he meant by:
"
CREATE TABLE selected_states
(stateid ...
othertableid...)
"
Was to create a table the just stored the individual state to contact information
state_unique_ID
state_number = 50
state_to_contact_ref_ID = $whoever_you_are_looking_for
otherinfo = "we drove there in 1934 in a packard car"
You can then either store the seperate static array for state information, (since they don't change much) or another database that you join onto for state info, or build an array in one call to the database that becomes you state array, and just ref it with the numeric value.
You don't want to have the database full of blank state fields for a number of reasons, including searching, and the idea that many peope may only have 1 state ( I presume) so you end up with all those blank records.
so,
1 id, 1 state number, 1 contact_ref_ID, end of row
2 id, 5 state number, 1 contact_ref_ID, end of row
3 id, 6 state number, 4 contact_ref_ID, end of row
4 id, 3 state number, 4 contact_ref_ID, end of row
5 id, 1 state number, 5 contact_ref_ID, end of row