-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathats_tr.php
More file actions
36 lines (29 loc) · 1013 Bytes
/
ats_tr.php
File metadata and controls
36 lines (29 loc) · 1013 Bytes
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
<?php
$dbserver = "hmiatsd.byethost31.com";
$dbuser = "hmiatsdb_ats";
$password = "m3c464r0n";
$dbname = "hmiatsdb_ats_prueba";
//$q = intval($_GET['q']);
$con = mysqli_connect($dbserver,$dbuser,$password,$dbname);
if (!$con) {
die('Could not connect: ' . mysqli_error($con));
}
mysqli_select_db($con,$dbname);
if (intval($_GET['lastId'] == 0)){
$rs = mysqli_query($con,"SELECT MAX(id) AS id FROM `datos_bats`");
$row = mysqli_fetch_array($rs);
$id = $row[0]; //obtengo el ultimo dato cargado
$sql= "SELECT `id`, `dia_serv`, `hora_serv`, `cadena` FROM `datos_bats` WHERE `id` = " . $id;
}
else{
$sql= "SELECT `id`, `dia_serv`, `hora_serv`, `cadena` FROM `datos_bats` WHERE `id` > " . intval($_GET['lastId']);
}
$result = mysqli_query($con,$sql);
while($row = mysqli_fetch_array($result)) {
echo $row['id'] . ";";
echo $row['dia_serv'] . ";";
echo $row['hora_serv'] . ";";
echo bin2hex(substr($row['cadena'], 0)) . ";";
}
mysqli_close($con);
?>