Jump to content

dbUpdate Associated Category Value


amwd07

Recommended Posts

Hello

struggling again after resolving my 1st issue all 100 categories are entered into the DB

the problem now which is stopping going further on this project is the correct category values in the DB are incorrect

 

all categories show the same value in this case 486 which is the last category Id printed from the array.

 

each subcategory should have the correct parent category  (id_xpress_cat)

but doesn't for some reason???

 

if(isset($_GET['viewsubcat'])){
foreach($this->_data['categories'] as $cat_name => $cat_count) {
  echo $cat_name."<br>";
}

  foreach($this->_data['product'] as $key => $data) {
    $xpress_cat = $data['item_category']; 
  // echo $data['item_category']."<br />";
}

  if($addcat || $updatecat) {
   $active = '1';
    if($row_xcat = dbSelect("SELECT * FROM ".WEBZSQL_DB_PREFIX."xpress_subcategory WHERE subcat_name = '".$cat_name."'",1)) {
    $id_subcat = $row_cat->id_subcat;
     if($row_xcat) {
      dbUpdate(WEBZSQL_DB_PREFIX."xpress_subcategory",array("id_xpress_cat" => $data['item_category']),' id_subcat = "'.$id_subcat.'" ');
     }

    }

Link to comment
https://forums.phpfreaks.com/topic/132787-dbupdate-associated-category-value/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.