SSISO Community

시소당

글 카테고리 함수 - set_ct_cnt

function  set_ct_cnt()  {
    global  $db,  $dbid;

    $sql  =  "select  no  from  t3_".$dbid."_ct1";
    $result  =  @mysql_query($sql);

    while(list($pno)  =  @mysql_fetch_array($result))  {
        $sql  =  "select  no  from  t3_".$dbid."_ct2  where  pno  =  $pno";
        $result2  =  @mysql_query($sql);

    while(list($no)  =  @mysql_fetch_array($result2))  {
        $sql  =  "select  count(*)  from  t3_".$dbid."  where  category2  =  '$no'  AND  is_public  =  '1'";
        list  ($cnt)  =  @mysql_fetch_array(@mysql_query($sql));
        put_query("update  t3_".$dbid."_ct2  set  cnt  =  '$cnt'  where  no  =  '$no'");
    }

    $sql  =  "select  count(*)  from  t3_".$dbid."  where  category1  =  '$pno'  AND  is_public  =  '1'";
    list  ($cnt)  =  @mysql_fetch_array(@mysql_query($sql));
    put_query("update  t3_".$dbid."_ct1  set  cnt  =  '$cnt'  where  no  =  '$pno'");
    }
}

1단계  카테고리  총글갯수  및  2단계  카테고리  총글갯수  구하는  함수  조건절은  공개형만  총갯수  포함

1162 view

4.0 stars