001.
<!DOCTYPE html>
002.
<html>
003.
<head>
004.
<meta http-equiv=
"refresh"
content=
"text/html; charset=utf-8"
/>
005.
<style>
006.
body{
007.
font-family: monospace;
008.
font-size: 17px;
009.
text-align: center;
010.
}
011.
</style>
012.
<body bgcolor=
"#EEAD0E"
>
013.
<form action=
""
method=
"POST"
>
014.
<input type=
"text"
name=
"data"
>
015.
<input type=
"submit"
name=
"submit"
value=
"save"
>
016.
</form><br>
017.
<title>Insert-Check back</title>
018.
<?php
019.
020.
$servername
=
"localhost"
;
021.
022.
023.
$dbname
=
"example"
;
024.
025.
026.
$username
=
"root"
;
027.
028.
$password
=
""
;
029.
030.
031.
032.
$conn
=
new
mysqli(
$servername
,
$username
,
$password
,
$dbname
);
033.
034.
if
(
$conn
->connect_error) {
035.
die
(
"Connection failed: "
.
$conn
->connect_error);
036.
}
037.
if
(
$_SERVER
[
'REQUEST_METHOD'
] ==
"POST"
){
038.
039.
$dataPesquisa
=
$_POST
[
'data'
];
040.
041.
$dataArray
=
explode
(
"-"
,
$dataPesquisa
);
042.
$dataPesquisa
=
$dataArray
[0];
043.
044.
echo
"CHECK DATA : "
.
$dataPesquisa
;
045.
046.
$sql
= "SELECT * FROM sensordata
047.
WHERE job_no LIKE
'%" . $dataPesquisa . "%'
";
048.
}
else
{
049.
050.
$dataAtual
= number(
''
);
051.
052.
$sql
=
"SELECT * FROM sensordata WHERE job_no LIKE '%"
.
$dataAtual
.
"%'"
;
053.
}
054.
055.
056.
057.
058.
059.
060.
061.
062.
063.
064.
065.
066.
067.
068.
069.
070.
071.
072.
echo
'<table border=
"1"
align=
"center"
cellspacing=
"5"
cellpadding=
"5"
bgcolor=
"#FFFFE0"
>
073.
<tr>
074.
<td><B>job_no</td>
075.
<td><B>sensor</td>
076.
</tr>';
077.
078.
if
(
$result
=
$conn
->query(
$sql
)) {
079.
while
(
$row
=
$result
->fetch_assoc()) {
080.
$row_job_no
=
$row
[
"job_no"
];
081.
$row_sensor
=
$row
[
"sensor"
];
082.
083.
084.
085.
086.
087.
088.
089.
echo
'<tr>
090.
<td>
' . $row_job_no . '
</td>
091.
<td>
' . $row_sensor . '
</td>
092.
</tr>';
093.
}
094.
$result
->free();
095.
}
096.
097.
$conn
->close();
098.
?>
099.
</table>
100.
</body>
101.
</head>
102.
</html>