1 |
|
---|
2 | <?php
|
---|
3 | //Build by: khristofer Usman
|
---|
4 | //Modified by: Jaypee Tanio
|
---|
5 | // June 22,2013
|
---|
6 | include '../include/factdb.php';
|
---|
7 | $Time =$_POST['Time'];
|
---|
8 | $SelectedSource = $_POST['Source'];
|
---|
9 | $SelectedMeasure = $_POST['measure'];
|
---|
10 | $limtex = count(explode(",",$SelectedSource));
|
---|
11 | $Upd=$_POST['upd'];
|
---|
12 | $Upt=$_POST['upt'];
|
---|
13 | $value = $_POST['Data'];
|
---|
14 | $date = $_POST['Date'];
|
---|
15 | $n_value = explode(",",$value);
|
---|
16 | $Times = explode(",",$Time);
|
---|
17 | $select = explode(",",$SelectedSource);
|
---|
18 | $measure = explode(",",$SelectedMeasure);
|
---|
19 | //date_default_timezone_set('Asia/Manila'); // Setting up the localTimeZone in asia
|
---|
20 | $UpdateDate=(date('Y-m-d H:i:s'));
|
---|
21 |
|
---|
22 |
|
---|
23 | $days = Date('Y-m-d',strtotime($date));
|
---|
24 |
|
---|
25 | $fetch = mysql_query("SELECT * FROM schedule") or die(mysql_error());
|
---|
26 |
|
---|
27 | while($rows = mysql_fetch_array($fetch))
|
---|
28 | {
|
---|
29 | $timestamp=strtotime($rows['fStart']);
|
---|
30 | $timestamp2 = date('Y-m-d',$timestamp);
|
---|
31 | $date_time = date('H:i',$timestamp);
|
---|
32 | //$time_new = $date_time->format('H:i:s')
|
---|
33 | if($days == $timestamp2)
|
---|
34 | {
|
---|
35 |
|
---|
36 | $delete = mysql_query("DELETE FROM `schedule` WHERE `fStart`='{$rows['fStart']}'");
|
---|
37 |
|
---|
38 | }
|
---|
39 | }
|
---|
40 |
|
---|
41 |
|
---|
42 | for($i=0;$i<=$limtex-1;$i++)
|
---|
43 | {
|
---|
44 | $select = explode(",",$SelectedSource);
|
---|
45 | $n1 = $n_value[$i];
|
---|
46 | $selectf = $select[$i];
|
---|
47 | $measuref = $measure[$i];
|
---|
48 | $dateTime=new DateTime($date." ".$Times[$i]);
|
---|
49 | $parsed_date = $dateTime->format('Y-m-d H:i:s');
|
---|
50 |
|
---|
51 | mysql_query("INSERT INTO schedule VALUES('null','".$parsed_date."','".$UpdateDate."','".$measuref."','','".$n1."','".$selectf."','".$measuref."')");
|
---|
52 |
|
---|
53 | }
|
---|
54 | ?> |
---|