0

I have tried for hours now trying to figure out how to do this and I'm sure its impossible, I have tried the following queries and still searching for the solution.
I need to display the subcategories, subcat_title table row based on the condition the table row cat_id is equal to the cat_id row of the categories table. Its working but not how I need it to as its repeating the table row cat_title from the categories table. I'm trying to get this query to work so I can create a Mega Menu for my site.
Any help would be very appreciated.

$sql = "SELECT * FROM categories c, subcategories s WHERE c.cat_id = s.cat_id ORDER BY ABS( `cat_title` )";
$sql = "SELECT COUNT(*) as repetitions, c.cat_id, c.cat_title, s.subcat_id, s.subcat_title, s.cat_id FROM subcategories AS s INNER JOIN categories AS c ON c.cat_id=s.cat_id GROUP BY s.cat_id HAVING repetitions > 1";
$sql = "SELECT c.cat_id, c.cat_title, s.subcat_id, s.subcat_title, s.cat_id FROM subcategories AS s LEFT OUTER JOIN categories AS c ON c.cat_id = s.cat_id ORDER BY c.cat_title";
2
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by mbhanley
0

I will be using a Mega menu and have Categories then SubCategories displayed underneath but I keep getting repeats on the category table row if you take a look at www.awholesaledirectory.com and hover over the category part on the menu you can see what I'm talking about a little better

0

I m not sure, javascript can process submitted form or not. so will will need perl in html2 for storing html1 values in hidden fields.

0

I m not sure, javascript can process submitted form or not. so will will need perl in html2 for storing html1 values in hidden fields.

It should show the menu when hovering over the categories tab not sure why it did not work for you maybe I was messing about with the code at the time but it does show.

Its repeating the categories table row cat_title once joined with the subcategories table.
so I get category title, then a subcategory title then it repeats its self in that way.

Rather than having a category title then a subcategory title and another subcategory title then another subcategory title.

The tables are set up like this.

(categories)
cat_id cat_title

(subcategories)
subcat_id subcat_title cat_id

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.