View Single Post
  #2  
Old 10-27-2009, 05:56 AM
  rogue's Avatar 
rogue rogue is offline
 

X-Adept
  
Join Date: Apr 2007
Location: Loveland, Ohio
Posts: 770
 

Default Re: Query help please...

I suspect that you need more than you are asking for here. But here is a single query that will do what you want I think.

Code:
$result = func_query(" SELECT cats.parentid FROM $sql_tbl[products] as prods, $sql_tbl[products_categories] as prod_cats, $sql_tbl[categories] as cats WHERE prods.product = '$p[product]' and cats.productid = prods.productid and prod_cats.categoryid = cats.categoryid and prod_cats.parentid = 1 ") if (count($result) == 1) { $pcatsection = 'dvds'; }

You should probably run the query from phpMyAdmin to make sure it does what you want.

Rick
Reply With Quote