source: schedule/Transaction/SaveSchedule.php@ 19594

Last change on this file since 19594 was 17550, checked in by tose, 11 years ago
New implementation for saving and updating schedule
File size: 1.0 KB
Line 
1 <?php
2//connect to the mysql
3$db = mysql_connect("localhost","scheduletest","t3stsched");
4mysql_select_db('sandboxschedule', $db) or die("Could not select database");
5
6 $dataArray = json_decode($_POST['Data']);
7 $day = date('Y-m-d', $_POST['Date']);
8 $numObservations = count($dataArray);
9 $count = 0;
10 mysql_query("DELETE FROM schedule WHERE DATE(fStart) = '$day'");
11 foreach($obsArr in $dataArray) {
12 foreach($schedArr in $obsArr) {
13 $datetime = new DateTime($day.$schedArray[0]);
14 $schedDate = date('Y-m-d H:i:s', $datetime);
15 $updateDate = date('Y-m-d H:i:s');
16 $seq = $schedArray[1];
17 $dataValue = $schedArray[2];
18 $source = $schedArray[3];
19 $measure = $schedArray[4];
20 mysql_query("INSERT INTO schedule VALUES('null','".$dateformat."','".$updateDate."','".$seq."','','".$dataValue."','".$source."','".$measure."')");
21 }
22 }
23 //database query
24 // mysql_query("INSERT INTO schedule VALUES('null','".$par."','".$part."','".$seq."','','".$data."','".$Source."','".$measure."')");
25 echo 'done';
26?>
Note: See TracBrowser for help on using the repository browser.