source: schedule/Transaction/update.php@ 17422

Last change on this file since 17422 was 17422, checked in by tanio, 11 years ago
File size: 1.3 KB
Line 
1 <?php
2//connect to the mysql
3$db = mysql_connect('localhost', 'root', '') or die("Could not connect database");
4mysql_select_db('sandboxschedule', $db) or die("Could not select database");
5
6
7 $GTimes=$_POST['GTime'];
8 $Source=$_POST['Source'];
9 $measure=$_POST['measure'];
10 $data=$_POST['Data'];
11 $Gdates = $_POST['GDate'];
12 $seq = $_POST['seq'];
13
14 $date = new DateTime($Gdates.$GTimes);
15 $par=$date->format('Y-m-d H:i:s');
16 $UpdateDate=(date('Y-m-d H:i:s'));
17
18 $days = Date('Y-m-d',strtotime($Gdates));
19 $cnt = 0;
20 //QUERY TO DELETE THE TABLE INSIDE THE DATABASE
21 //$fetch = mysql_query("SELECT * FROM schedule WHERE date(fStart)='$days'") or die(mysql_error());
22 //while($rows = mysql_fetch_array($fetch)){
23 //$update=mysql_query("UPDATE schedule SET `fStart`='$par',`fLastUpdate`='$UpdateDate',`fMeasurementID`='$seq',`fData`='$data',`fSourceKey`='$Source',`fMeasurementTypeKey`='$measure' WHERE fScheduleID = '".$rows['fSchecduleID']."' ");
24
25 //mysql_query("DELETE FROM schedule WHERE date(fStart)='".$rows['fStart']."'");
26 mysql_query("INSERT INTO schedule VALUES('null','".$par."','".$UpdateDate."','".$seq."','','".$data."','".$Source."','".$measure."')");
27 //}
28
29
30 //$delete = mysql_query("DELETE FROM `schedule` WHERE `fStart`='{$rows['fStart']}'");
31 //database query
32
33?>
Note: See TracBrowser for help on using the repository browser.