forked from vscarpenter/webSqlApp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetModifiedUnit.php
59 lines (52 loc) · 1.84 KB
/
getModifiedUnit.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
//include "loginCheck.php";
//if ($CLnum_rows){
// switch ($_REQUEST['Version']){
// case $KEY_RDNET:
//get updated records from the last sync date
// If first sync:
if ($clientLastSyncDate = 0){ //If first sync
$query = "SELECT UniteID, UniteSymbol"
." FROM RN_Unite"
." ORDER BY UniteID ASC ";
}
else{
$query = "SELECT UniteID, UniteSymbol FROM RN_Unite WHERE last_sync_date > '". $clientLastSyncDate ."' ORDER BY UniteID ASC ";
}
/*
$query = "SELECT UniteID, UniteSymbol"
." FROM RN_Unite"
." ORDER BY UniteID ASC ";
*/
/* break;
case $KEY_EXPERTUP:
$query = "SELECT UniteID, UniteSymbol"
." FROM EX_Unite"
." ORDER BY UniteID ASC ";
break;
default: echo $_REQUEST['Version'];
}
*/
$sql_result = array();
$sql = mysql_query($query);
while($row = mysql_fetch_object($sql)){
$sql_result[] = $row;
}
/* To do: Change last_sync_date of the server record
//$count = count($clientData['data']['Contacts']);
for ($i=0; $i < $count; $i++) {
$moreRecentSQL = "SELECT last_sync_date FROM RN_Unite WHERE ContactID = ". $ContactID;
//echo $moreRecentSQL, "<br>", "<br>";
$moreRecentResult = mysql_query($moreRecentSQL) or die(mysql_error());
$row_moreRecentResult = mysql_fetch_assoc($moreRecentResult);
$serverRec_last_sync_date = $row_moreRecentResult['last_sync_date'];
$clientRecLastSyncDate = $newrec['last_sync_date']; $clientRecLastSyncDate = mysql_real_escape_string($clientRecLastSyncDate);
if ($serverRec_last_sync_date < $clientLastSyncDate){
$sqlUpdate = "UPDATE RN_Unite SET last_sync_date='". $currentDateTime ."' WHERE ContactID=". $ContactID ;
//echo $sqlUpdate, "<br>", "<br>";
$queryUpdate = mysql_query($sqlUpdate) or die('line 100. '.mysql_error());
}
*/
return $sql_result;
//} end if ($CLnum_rows) used for authentication
?>