$sql = "select COUNT(id) from action "; $where1 .= " and isfirst = 'T' "; $where2 .= " and isfirst = 'T' "; if (hasCondition($sex, $state, $country)) { $where1 = setFirstCondition($where1, $sex, $state, $country); } if (hasUser($user)) { $where1 = setUser($where1, $user); } if (setInsertTime1($fromTime, $toTime)) { $where1 = getInsertTime1($where1, $fromTime, $toTime); } if (hasCondition($dump_sex, $dump_state, $dump_country)) { $where2 = setFirstCondition($where2, $dump_sex, $dump_state, $dump_country); } if (hasUser($dump_user)) { $where2 = setUser($where2, $dump_user); } if (setInsertTime1($fromTime, $toTime)) { $where2 = getInsertTime1($where2, $fromTime, $toTime); } } } } } else { echo "something wrong happens"; exit; } $sql1 = $sql . $where1; $sql2 = $sql . $where2; $sum[0] = countNum($sql1);
private function _register($data) { $role = 10; $this->Mdl_users->setData('register', $data['email'], $data['password'], $role, $data['name'], $data['phone']); if (!hasUser()) { if ($this->Mdl_users->register('normal_registration')) { if ($this->sendMail()) { $this->Mdl_users->insertToken(); setInformUser('success', 'Your account is created successfully.<br> Please check your mail for account activation/'); redirect(base_url('users')); } else { setInformUser('error', 'Account registered but email not sent. Please try again.'); redirect(base_url('users/signup')); } } } else { setInformUser('error', 'Email Allready registered. Please Login. '); redirect(base_url('users/signup')); } }
} 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); print_r(json_encode($result)); function creatTrend($sql)