Jump to content

Should I just try to use "chained selects" to solve the problem?


JTapp

Recommended Posts

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

Link to comment
Share on other sites

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'

Link to comment
Share on other sites

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 ;)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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]";

}

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.