
September 4th, 2004, 03:29 AM
|
|
Registered User
|
|
Join Date: Aug 2004
Posts: 26
Time spent in forums: 24 m 7 sec
Reputation Power: 0
|
|
|
Arrays?
Ok, since I guess Im never going to figure out the JOIN crap that goes with sql maybe I can work with an array. What I want to do is search through one table based on state and county fields and get the UserID(s) from that table where it matches, even if theres more than one.. Then I want to take the UserID(s) from that first table and match it to the UserID(s) in a second table and pull the email field. So a user fills out a form, part of the form has dynamic drop downs where they select a state, then it populates the county dropdown and they select their county. Then when they submit this it will go through table1 and search for UserID based on the St. and Co. that were chosen, then match the UserID(s), to the UserID(s) in table2 and get the email field from table2. Ive tried the JOIN stuff, doesnt work. In table1 the fields are UserID, State, County. In table2 the fields are UserID, name, address, email.
Is it possible to just:
SELECT UserID FROM table1 WHERE State=Whatever AND County=Whatever
and then store this in an array. Then to do something like:
SELECT email FROM table2 WHERE UserID=Array of UserID(s) from table1?
1. Is this possible?
2. How do you store the info from the first select statement into an array, and then in the second select statement tell it to match UserID to the UserIDs in the array??
Any idea on if this is possible and how to do this?
Thanks
|