JTapp Posted February 22, 2008 Share Posted February 22, 2008 Hey guys, I have two posts - same question - different wording - that aren't getting any responses. I'm starting to think my problem is just way too complicated and I'm wondering if I should try to use "chained selects" to solve the problem? (not that I know what I'm doing). http://www.phpfreaks.com/forums/index.php/topic,183710.0.html http://www.phpfreaks.com/forums/index.php/topic,183594.msg820992.html#msg820992 Quote Link to comment https://forums.phpfreaks.com/topic/92467-should-i-just-try-to-use-chained-selects-to-solve-the-problem/ Share on other sites More sharing options...
drisate Posted February 22, 2008 Share Posted February 22, 2008 hmm i am not sur i understand your question ... but if it's abbout displaying results of only one company why not using a var in your url like www.this-site.com?index.php?id=222 then clean the $_GET[id] and place it in your sql query like this SELECT * FROM this_table WHERE id='$cleaned_id' Quote Link to comment https://forums.phpfreaks.com/topic/92467-should-i-just-try-to-use-chained-selects-to-solve-the-problem/#findComment-473727 Share on other sites More sharing options...
aschk Posted February 22, 2008 Share Posted February 22, 2008 Re-posting the same question several times isn't going to help your issue. What you have to do is break it down into chunks. i.e. from what I have gather you're having some sort of issue with showing what you want to show. You need to break it down for us by detailing the following: a) what your table layout it b) how the tables join THEN, you need to tell us what information you want back from your query? e.g. ALL the officers from a particular lodge If you do that, then i'm sure it'll save us some time having to trawl your code to work out what you're up to Quote Link to comment https://forums.phpfreaks.com/topic/92467-should-i-just-try-to-use-chained-selects-to-solve-the-problem/#findComment-473729 Share on other sites More sharing options...
JTapp Posted February 22, 2008 Author Share Posted February 22, 2008 Thanks for your time drisate - I'm a beginner and I just don't know if this is too complicated of an issue for a forum like this.. Here is a fictional version of the scenario I am trying to achieve - - let's say you are searching for a Department of Motor Vehicles office closest to you. So you go to a website and you plug in your zip code. What you get in return, is a table with four offices in that zip code. Glancing at this table you choose the office you want and you click on a "view details" button to go to another page with specifics about that particular office.. such as directions, phone numbers, etc. So this is what I'm having to create - The way I am currently set up is - you plug in your zip code (http://www.la-mason.com/2search.html - search for zip 71129) and you get a single webpage with excessive scroll down, listing all of companies in that zip code and all of their detailed information (directions, phone numbers, etc). I have to break it down.. does that make sense? This link is a non-active graphical representation of what I need http://www.la-mason.com/2resultsA.phpis --- so when you click "View" it takes you to the detailed information of just that company. Quote Link to comment https://forums.phpfreaks.com/topic/92467-should-i-just-try-to-use-chained-selects-to-solve-the-problem/#findComment-473784 Share on other sites More sharing options...
drisate Posted February 23, 2008 Share Posted February 23, 2008 so all you have to do is put the id of that company an send it in the adress like this http://www.la-mason.com/profile.php?id=21 then you grab that id using $_GET[id] and use that to build yoou query that will bring up everything $list = mysql_query("SELECT * FROM `mytable` WHERE id='$_GET[id]'") or die (mysql_error()); if (mysql_num_rows(list)) { while ($company= mysql_fetch_array($list)) { // Then you can use $company[] echo "This is the comapany name: $company[name]"; } } Quote Link to comment https://forums.phpfreaks.com/topic/92467-should-i-just-try-to-use-chained-selects-to-solve-the-problem/#findComment-474214 Share on other sites More sharing options...
Barand Posted February 23, 2008 Share Posted February 23, 2008 I'd recommend an AJAX solution to dynamically create the next select from the option selected in the previous one. There's an example in my sig. If all your primary keys are numeric you can also use the baaselect method in my sig. Quote Link to comment https://forums.phpfreaks.com/topic/92467-should-i-just-try-to-use-chained-selects-to-solve-the-problem/#findComment-474401 Share on other sites More sharing options...
drisate Posted February 23, 2008 Share Posted February 23, 2008 wow looks nice :-) You should put up live exemples to play with. I never toutched ajax yet ... lol i always managed with out it ... in this case JS would be great and easy but ajax gets more popular everyday. I am gona have to learn it soon. >.< Quote Link to comment https://forums.phpfreaks.com/topic/92467-should-i-just-try-to-use-chained-selects-to-solve-the-problem/#findComment-474408 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.