Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "mysql.hostinger.ru";
- $username = "u761866288_rut";
- $password = "jamaica123";
- $dbname = "u761866288_db";
- date_default_timezone_set('Europe/Riga');
- $date = date('m/d/Y H:i:s');
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- if($_GET['i'] == "")
- {
- echo "No Data!";
- }
- else
- {
- $t1 = htmlspecialchars($_GET["a"]);
- $h1 = htmlspecialchars($_GET["b"]);
- $wt1 = htmlspecialchars($_GET["c"]);
- $wd1 = htmlspecialchars($_GET["d"]);
- $wt2 = htmlspecialchars($_GET["e"]);
- $wd2 = htmlspecialchars($_GET["f"]);
- $ph = htmlspecialchars($_GET["g"]);
- $ppm = htmlspecialchars($_GET["h"]);
- $light = htmlspecialchars($_GET["i"]);
- $fan1 = htmlspecialchars($_GET["j"]);
- $ram = htmlspecialchars($_GET["k"]);
- $sql = "INSERT INTO data (time, temp1, humi1, wt, wd, wt2, wd2, ph, ppm, light, fan1, ram)
- VALUES ('$date', '$t1', '$h1', '$wt1', '$wd1', '$wt2', '$wd2', '$ph', '$ppm', '$light', '$fan1', '$ram')";
- $result = $mysqli->query('SELECT `tmax`, `thigh`, `tnorm`, `tmin` FROM ard_settings ORDER BY `id` DESC LIMIT 1');
- if ($result->num_rows > 0) {
- // output data of each row
- while($row = $result->fetch_assoc()) {
- echo "Error: " . $sql . "<br>" .;
- }
- if ($conn->query($sql) === TRUE) {
- } else {
- echo "" . $row["tmax"]. "," . $row["thigh"]. "," . $row["tnorm"]. "," . $row["tmin"]. ""
- }
- $result->close();
- $conn->close();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement