示例#1
0
     $rs3 = mysql_fetch_array($query3);
     if ($rs3) {
         $countF = $rs3[0];
     } else {
         $countF = 0;
     }
     $sex = "[{value:'" . $countM . "', name:'male'},{value:'" . $countF . "',name:'female'},]";
     $json_sex = json_encode($sex);
     echo $json_sex;
 } else {
     if ($flag == "f5") {
         $month = array();
         $countMonth = array();
         $sum = array();
         $sql = "select insertmonth,count(insertmonth) from action";
         if (setInsertTime($startTime, $endTime)) {
             $where = getInsertTime($where, $startTime, $endTime);
         }
         $where .= " group by insertmonth ";
         $sql .= $where;
         $query = mysql_query($sql);
         while ($rs = mysql_fetch_array($query)) {
             if ($rs[0] != null) {
                 $month[] = $rs[0];
                 $countMonth[] = $rs[1];
             }
         }
         $sum[0] = $month;
         $sum[1] = $countMonth;
         $json_sum = json_encode($sum);
         print_r($json_sum);
示例#2
0
            if (hasCondition($sex, $state, $country)) {
                $where = setCondition($where, $sex, $state, $country);
            }
            if (hasTime($startMonth, $endMonth, $beforeMonth, $afterMonth, $onMonth)) {
                $where = setconfirmedTime($where, $startMonth, $endMonth, $beforeMonth, $afterMonth, $onMonth);
            }
            $where .= " GROUP BY left(confirmtime,7)";
        } else {
            if ($question == "firsttimeuser") {
                $sql = "select insertmonth, COUNT(insertmonth) from action ";
                $where .= " and isfirst = 'T' ";
                if (hasCondition($sex, $state, $country)) {
                    $where = setFirstCondition($where, $sex, $state, $country);
                }
                if (hasTime($startMonth, $endMonth, $beforeMonth, $afterMonth, $onMonth)) {
                    $where = setInsertTime($where, $startMonth, $endMonth, $beforeMonth, $afterMonth, $onMonth);
                }
                if (hasUser($user)) {
                    $where = setUser($where, $user);
                }
                $where .= " GROUP BY insertmonth";
            }
        }
    }
} else {
    echo "something wrong happens";
    exit;
}
$sql = $sql . $where;
//echo $sql;
$result = creatTrend($sql);