-
Notifications
You must be signed in to change notification settings - Fork 1
/
taomoi.php
29 lines (24 loc) · 1.28 KB
/
taomoi.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
$magv=$_SESSION['magv'];
include 'connect.php';
$ngay = '1';
$thang = date('m');
$nam = date('y');
$dates = $nam . "-" . $thang . "-" . $ngay;
$sql = "SELECT * FROM ctcongviec WHERE ngaythuchien='$dates' AND magv='$magv'" ;
$result = $conn->query($sql);
if($result -> num_rows == 0)
{
$magv = $_SESSION['magv'];
$ghichu="";
$macong = "";
for($ngay=1;$ngay <= date('t'); $ngay++)
{
$ngaycham = "".date('y')."-".date('m')."-".$ngay;
$sqlsang = "INSERT INTO ctcongviec(magv,macongviec,ngaythuchien,buoi,ghichu) VALUES('$magv','$macong','$ngaycham','sang','$ghichu')";
$sqlchieu = "INSERT INTO ctcongviec(magv,macongviec,ngaythuchien,buoi,ghichu) VALUES('$magv','$macong','$ngaycham','chieu','$ghichu')";
$conn->query($sqlsang);
$conn->query($sqlchieu);
}
}
?>