Example #1
0
function Add($No, $isLast, $pdo)
{
    $id = getID($No, $pdo);
    $data = Fetch_Data($id, $pdo);
    $last = $isLast;
    $name = $data['Name'];
    $phone = $data['phone'];
    $email = $data['email'];
    memberList($No, $id, $name, $phone, $email, $last);
}
Example #2
0
    $p1 = $row['pro1'];
    $p2 = $row['pro2'];
    $p3 = $row['pro3'];
}
$sth = $pdo->prepare("SELECT * FROM students WHERE Student_ID = :id");
$sth->bindParam(':id', $id, PDO::PARAM_STR);
$sth->execute();
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
    $name = $row['Name'];
    $pic_url = $row["pic_url"];
    $email = $row["email"];
    $faculty = $row["Faculty"];
}
$s1 = Fetch_Data($std1, $pdo);
$s2 = Fetch_Data($std2, $pdo);
$s3 = Fetch_Data($std3, $pdo);
?>
<html>
   <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <title>AdminLTE 2 | Starter</title>
      <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
      <?php 
include_css();
?>
      <?php 
res();
?>
      <link rel="stylesheet" href="css/animate.min.css">
      <script type="text/javascript" src="js/script_for_cpe01.js"></script>
function Generate_Date_Range($station_id, $Past_year)
{
    global $No_Past_year;
    $Current_Month = Date('m');
    $Current_Year = Date('Y');
    $Last_Year = Date('Y', strtotime('-' . $No_Past_year . 'years'));
    $Last_Month = Date('m', strtotime('-' . $No_Past_year . 'years'));
    foreach ($Past_year as $year) {
        $Total_Month = 12;
        $Month = 1;
        if ((int) $Last_Year == (int) $year) {
            $Month = (int) $Last_Month;
        }
        while ($Month <= $Total_Month) {
            if ($Month == (int) $Last_Month && $year == (int) $Last_Year) {
                $first_day = Date('d', strtotime('-' . $No_Past_year . 'years'));
                $Start_timestamp = strtotime($first_day . '-' . $Month . '-' . $year);
                $last_day = Date('d', strtotime('last day of' . $Month . 'month'));
                $End_timestamp = strtotime($last_day . '-' . $Month . '-' . $year);
                $End_timestamp = strtotime('+1 day', $End_timestamp);
            } else {
                if ($Month == (int) $Current_Month && $year == (int) $Current_Year) {
                    $last_day = Date('d');
                    $End_timestamp = strtotime($last_day . '-' . $Month . '-' . $year);
                    $End_timestamp = strtotime('+1 day', $End_timestamp);
                    $first_day = Date('d', strtotime('first day of' . $Month . 'month'));
                    $Start_timestamp = strtotime($first_day . '-' . $Month . '-' . $year);
                    $Total_Month = $Current_Month;
                } else {
                    if ($Month == 2 && isLeapYear($year)) {
                        $End_timestamp = strtotime('29-' . $Month . '-' . $year);
                        $End_timestamp = strtotime('+1 day', $End_timestamp);
                        $first_day = Date('d', strtotime('first day of' . $Month . 'month'));
                        $Start_timestamp = strtotime($first_day . '-' . $Month . '-' . $year);
                    } else {
                        $last_day = Date('d', strtotime('last day of' . $Month . 'month'));
                        $End_timestamp = strtotime($last_day . '-' . $Month . '-' . $year);
                        $End_timestamp = strtotime('+1 day', $End_timestamp);
                        $first_day = Date('d', strtotime('first day of' . $Month . 'month'));
                        $Start_timestamp = strtotime($first_day . '-' . $Month . '-' . $year);
                    }
                }
            }
            $jsonResult = Fetch_Data($station_id, $Start_timestamp, $End_timestamp);
            $result = json_decode($jsonResult, true);
            $totalResult = $result['cnt'];
            $count = 0;
            Write_Weather_Header($year, $Month);
            while ($count < $totalResult) {
                $array = convertMultiDimJsonToAssoc($result['list'][$count]);
                Write_Weather_Data($array, $year, $Month);
                $count++;
            }
            $Month++;
        }
    }
}