View Single Post
  #1  
Old 10-27-2009, 04:08 AM
 
mrerotic mrerotic is offline
 

eXpert
  
Join Date: Feb 2009
Posts: 264
 

Default Query help please...

How can I check to see if parentid = '1' for a product? I think my query below is wrong can someone please verify that this query should work?
PHP Code:
$test func_query("SELECT productid FROM $sql_tbl[products] WHERE product = '$p[product]'");
// Get category parentid to find section for product
$pcatquery "SELECT categoryid FROM $sql_tbl[products_categories] WHERE productid = '".$test."'";
$prodcatinfo func_query($pcatquery);
 
if (!empty(
$prodcatinfo)){
foreach (
$prodcatinfo as $pcat){
$getpquery func_query("SELECT parentid, category FROM $sql_tbl[categories] WHERE categoryid = '".$pcat['categoryid']."'");
foreach (
$getpquery as $getpcat){
if (
$getpcat['parentid'] != '0'){
if (
$getpcat['parentid'] == '1'){
$pcatsection "dvds";
}
}
}
}

__________________
x-cart 4.2.3
AlteredCart Smart Search
Auto Featured Products Mod (Personal Mod)
BCSE Product Importer Pro & Drop Shipper Pro
CDSEO Pro
CMS EZRecommends
EE slider login (Personal Mod)
Next Prev Link Mod (Customized)
ShadowBox Detailed Images (Personal Mod)
Shop By Price (Customized)
Social Media (Personal Mod)
Switch Layout View (Personal Mod)
Special Offers
Testimonials (Personal Mod)
Whats New (Customized)
Reply With Quote