The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Looking for a Query that fits the fallowing explanation, Help please.....

I will explain in details what I want to achieve first, and then I will post the code explaining and clarifying bit by bit for your understanding. in other words you will be able to see what can be done about the purpose or achievements i want to do.

What I want to achieve is:

First, I have three headings and within each of the three headings you will find different subheadings. The subheadings will only appears once an user click on any of the three headings when one heading is clicked on then the subheadings display downward. for example:

Illustration 1

Sneakers

Nike

Adidas

Fila

Boots
DressShoes

Explanation of Illustration 1.

In this illustration there are three headings; Sneakers, Boots and DressShoes. The one clicked on is Sneakers and it shows or display a list of subheadings. In this case we have three subheadings Nike, Addidas and Fila. if you notice the others Headings stay closed containing its subheadings within because they haven't been clicked on. The set up of the code or what the code I have built so far does as fallows:

1- Enter the web address and the three headings appears

Sneakers
Boots
DressShoes

2-A user click on a heading in this case the Sneakers heading and it display the subheadings of that heading called Sneakers and leave the subheadings of that heading (Sneakers) displayed, If you notice the others heading stay closed containing its subheadings inside but not visible.

Sneakers

Nike

Addias

Fila

Boots
DressShoes

3-From this point if a user click on any other heading let say Boots

Sneakers
Boots

Timberland

Deakers

Western Boots

DressShoes

4 Then the subheadings of the previous clicked on heading Sneakers disappear in other words close the previous heading along with its subheadings,
5-And then display the subheadings of the recent clicked on heading in this case Boots and leave it displayed. if you notice the Sneakers and DressShoes stay closed containing its subheadings inside but not visible to the users at this point.

Second part
My Purpose is:

The subheadings as I said will only display downward when you click on one of the headings which is ok. It display the subheadings and when I click on one of the subheading then it shows the content of the selected subheading in a table that I have styled to be at the right side of the page.
Illustration 2

Sneakers

Nike

Addias

Fila

Boots
DressShoes

Explanation of the illustration 2 if for example the Nike subheading is clicked on then the content would displayed. The content would be placed in the table to the right of the page.
1-Air jordan
2-Air force
3-Air jordan D-Zero
4-Jordan true Flight Man
5-Lebroms Nike
As it display the content of the subheading *Nike it closes all the headings and comeback to the default state leaving the content of the *Nike display.

But the headings placed in a table at the left of the page comeback to the Default state.

Sneakers
Boots
DressShoes

in others words, it display the content of the subheading but it doesn't leave the subheadings displayed underneath the heading selected which in this case was Sneakers.So that if a user want to select or choose another subheading other than the *Nike subheading within the heading Sneakers, to display the content of any other desired subheading in the table placed to the right of the page, the user has to open the Sneakers heading again and choose any other subheading than the *Nike for instance *Adidas to see Adidas content.

Instead I want to display the headings as default just as it is, and once an user clicked on a heading then the subheadings underneath that heading display. Onto that point that's how the actual coding I have now is set up. But after that point I want the subheadings to display the content in the table styled at the right side of the web page and at the same time I want the subheadings underneath the clicked on heading in this case *Nike *Adidas *Fila to stay displayed and visible after an user click on one of the subheadings to display its content in the table, instead avoid the headings coming back to the default state which disappear all the subheadings underneath that subheading in this case Sneakers.

default state:

Sneakers
Boots
DressShoes

Sneakers

Nike

Addias

Fila

Boots
DressShoes

Click on the *Nike subheading and it shows the content of *Nike but it comes
back to:

default state

Sneakers
Boots
DressShoes

Instead of leaving the subheading of the Heading Sneakers visible and still shows the content.

These are the values I have (isset) on the top of the document. The $_GET variable which I understand function as a variable that scatter its values through out the whole document right?. That what I understand the $_GET variable does. As explain you the code you will see the values scattered through the document.

The next bit of code it's what fallows after I (isset) the variables

PHP Code:

<ul class="menu">
<?php
$query = "SELECT *
FROM menusubjects "; //headings are called on this query

Now my final question is, where within this code I could place a condition where subheadings display its content and at the same time the subheadings stay displayed underneath the headings which is the final part of the purpose I described and detailed above.

There are a final part of the entire php code i have which contain a query that calls the content of the subheadings which will be displayed in a table found within this final part of the php code set up in this file, and it goes as follows:

PHP Code:

<?php $query = "SELECT shoe.shoename, shoe.price, shoe.moreinfo
FROM shoe
WHERE
shoe_kind = ". (int) $_GET['shoe']; // $_GET value I extract it from the (isset) selection at the top of the code. This condition will show the content if the shoe_kind is == to $_GET value. I don't know if the query or purpose described above need a query to be place before this query or after this query and table found on this final part of my code.
echo $query
$result = mysql_query($query, $connection);
while ($content = mysql_fetch_array($result)) {
echo "<table style=\"float:left\">
<td width=\"150\" style=\"text-align:center;\">" . $row['shoename'] . "</td>
<tr>
<td height=\"100\" width=\"100\" style=\"position:relative;\">
<img src=\"../images/shoesname.jpg\" alt=\"sd\" width=\"97\" height=\"80\" border=\"1\" style=\"border-color:#FF6600;\" />
</td></tr>
<tr>
<td width=\"5\" height=\"21\" ></td><td>" . $row['price'] . "</td>
</tr>
<td>" . $row['moreinfo'] . "</td>
</table>";
}
?>

<?php
mysql_close($connection);
?>

Help please...
Again where could I locate a query and condition

where I Click on subheading in this case the *Nike subheading it shows the content of *Nike but instead of coming back to:

default state

Sneakers
Boots
DressShoes

Instead of leaving the subheadings of the Heading Sneakers visible and still shows the content like this.

The behavior of the php code found above display an accordion menu. But the purpose still not met. Well now i know It is not a query problem but a proper set up of the code. Please see the code above and see how can you form some subjection to modify the code toward the fallows:

Where I Click on subheading in this case the *Nike subheading it shows the content of *Nike but instead of coming back to:

default state
Quote:

Sneakers
Boots
DressShoes

Instead of leaving the subheadings of the Heading Sneakers visible and still shows the content like this.

What could I do to arrange this code so that the subheadings of the heading still display whether a users click on one subheading instead of performing the normal accordion behavior which closes the subheadings once a heading is clicked on.

Just want you to know that at this point the $rmenu variable hasn't been defined, it is defined after the next query that fallows this code line. I don't know if that will affect the performance even though that is not the error at his moment, the error consist still in a parse error.