commit 45de5c4e4e04b18eb6fe158fa0150bc7a8b2249c Author: santhosh Date: Wed Nov 9 11:15:16 2022 +0530 make it better diff --git a/index.php b/index.php new file mode 100644 index 0000000..eaf10a3 --- /dev/null +++ b/index.php @@ -0,0 +1,76 @@ + + + + + + + + Sensor Data + + + + + +

SENSOR DATA

+connect_error) { + die("Connection failed: " . $conn->connect_error); +} + +$sql = "SELECT id, Tank1, Tank2, rainwater, Turbidity,pH_sensor, reading_time FROM sensordata ORDER BY id DESC"; /*select items to display from the sensordata table in the data base*/ + +echo ' + + + + + + + '; + +if ($result = $conn->query($sql)) { + while ($row = $result->fetch_assoc()) { + + $row_Tank1 = $row["Tank1"]; + $row_Tank2 = $row["Tank2"]; + $row_Turbidity = $row["Turbidity"]; + $row_pH_sensor = $row["pH_sensor"]; + $row_reading_time = $row["reading_time"]; + + echo ' + + + + + + + + + + '; + } + $result->free(); +} + +$conn->close(); +?> +
Storage TankPotashAlum Tank + + TurbiditypH_sensorData Time
' . $row_Tank1 . '' . $row_Tank2 . '' . $row_Turbidity . '' . $row_pH_sensor . '' . $row_reading_time . '
+ + + + + + + + + \ No newline at end of file diff --git a/post-esp-data.php b/post-esp-data.php new file mode 100644 index 0000000..6d526f2 --- /dev/null +++ b/post-esp-data.php @@ -0,0 +1,52 @@ +query($sql) === TRUE) { + echo "New record created successfully"; + } + else { + echo "Error: " . $sql . "
" . $conn->error; + } + + $conn->close(); + } + else { + echo "Wrong API Key provided."; + } + +} +else { + echo "No data posted with HTTP POST."; +} + +function test_input($data) { + $data = trim($data); + $data = stripslashes($data); + $data = htmlspecialchars($data); + return $data; +} +?> \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..a4ab14c --- /dev/null +++ b/style.css @@ -0,0 +1,31 @@ + +body { + background: #f5efe0; + box-sizing: border-box; + color: #000; + font-size: 1.8rem; + letter-spacing: -0.015em; + text-align: center; +} +table { +margin-left: auto; +margin-right: auto; +width: 80%; +} + +th { +font-family: Arial, Helvetica, sans-serif; +font-size: 20px; +background: #666; +color: #FFF; +padding: 2px 6px; +border-collapse: separate; +border: 1px solid #000; +} + +td { +font-family: Arial, Helvetica, sans-serif; +font-size: 15px; +text-align: center; +border: 1px solid #DDD; +} diff --git a/text.php b/text.php new file mode 100644 index 0000000..bce439f --- /dev/null +++ b/text.php @@ -0,0 +1,26 @@ +query($sql) === TRUE) { + echo "New record created successfully"; + } + else { + echo "Error: " . $sql . "
" . $conn->error; + } + + $conn->close(); \ No newline at end of file