Welcome Guest, Not a member yet? Register   Sign In
Logical Problem With category and sub-category
#1

[eluser]woomacoder[/eluser]
Hello Everybody,

I have a problem (logical problem) with Managed my category and subcategory database; the code is it:

Code:
public function GetCats($UriString)
      {
          $DataSet = self::GetCatsRel($UriString);

          foreach($DataSet->result() as $Row)
          {
               $sql = "SELECT
                              c.id as cat_id, c.sub_cats as sub_cats,
                              c.name as cat_name, c.end as cat_end,
                              c.warning as cat_warning, c.class as cat_class,
                              c.completed as cat_completed
                         FROM cats as c
                         WHERE c.id = ".$Row->cat_id."
                         AND c.macro_id = ".$Row->macro_id." ;";

                $DataSet = $this->db->query($sql);

                foreach($DataSet->result() as $Row)
                {
                     if($Row->sub_cats != 0)
                     {
                          echo "INCAZUS";
                          break;
                     }
                }
          }
          return $DataSet;
      }

      public function GetCatsRel($UriString)
      {
           // query String
           $sql = "SELECT
                    r.id, r.macro_id as macro_id, r.cat_id as cat_id, r.subcat_id
                         FROM relcats as r
                    WHERE macro_id = ".$this->db->escape($UriString);
          
           // eseguo la queyr
           return $this->db->query($sql);
      }

INCAZUS is my personal word to identified a right status, where code works!
I have two table:

CATS table, with id, sub_cat (counter of subcategory), name and some values.
SUBCATS table, with id, parent cat id (for related subcategory with father's category) and some values.

But... Sad php print_r reports:

Code:
CI_DB_mysql_result Object ( [conn_id] => Resource id #28 [result_id] => Resource id #48 [result_array] => Array ( ) [result_object] => Array ( [0] => stdClass Object ( [cat_id] => 6 [sub_cats] => 0 [cat_name] => Prova dopo ciclo [cat_end] => 2009-04-24 12:51:01 [cat_warning] => 0000-00-00 00:00:00 [cat_class] => B [cat_completed] => 0 ) ) [current_row] => 0 [num_rows] => 1 [row_data] => )

The code pass the latest value of the CATS table!!!
Why? Where is the error?

Thanks and sorry for bad english Wink


Messages In This Thread
Logical Problem With category and sub-category - by El Forum - 04-24-2009, 06:00 AM
Logical Problem With category and sub-category - by El Forum - 04-24-2009, 10:36 AM
Logical Problem With category and sub-category - by El Forum - 04-24-2009, 11:07 AM
Logical Problem With category and sub-category - by El Forum - 04-24-2009, 12:14 PM
Logical Problem With category and sub-category - by El Forum - 04-24-2009, 12:39 PM
Logical Problem With category and sub-category - by El Forum - 04-24-2009, 04:44 PM
Logical Problem With category and sub-category - by El Forum - 04-25-2009, 02:32 AM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 01:34 PM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 01:49 PM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 01:56 PM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 02:02 PM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 02:08 PM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 02:16 PM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 02:18 PM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 02:21 PM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 02:24 PM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 02:26 PM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 06:06 PM
Logical Problem With category and sub-category - by El Forum - 09-11-2009, 07:31 AM
Logical Problem With category and sub-category - by El Forum - 09-11-2009, 07:48 AM
Logical Problem With category and sub-category - by El Forum - 09-11-2009, 07:51 AM
Logical Problem With category and sub-category - by El Forum - 09-11-2009, 07:56 AM
Logical Problem With category and sub-category - by El Forum - 09-11-2009, 08:12 AM
Logical Problem With category and sub-category - by El Forum - 09-11-2009, 08:18 AM
Logical Problem With category and sub-category - by El Forum - 09-11-2009, 08:36 AM
Logical Problem With category and sub-category - by El Forum - 09-11-2009, 09:07 AM
Logical Problem With category and sub-category - by El Forum - 09-11-2009, 09:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB