Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "roydl7";
- $password = "lolwtf";
- $dbname = "dht11";
- date_default_timezone_set("Asia/Kolkata");
- $logtime = date('Y-m-d H:i:s');
- $temp = $_GET['temp'];
- $conn = mysql_connect("localhost", $username, $password);
- if (!$conn)
- {
- die('Could not connect: ' . mysql_error());
- }
- $con_result = mysql_select_db("dht11", $conn);
- if(!$con_result)
- {
- die('Could not connect to specific database: ' . mysql_error());
- }
- $hvalue = $temp;
- $sql = "INSERT INTO `temperature` (`log`, `temp`) VALUES ('$logtime', '$temp')";
- $result = mysql_query($sql);
- if (!$result) {
- die('Invalid query: ' . mysql_error());
- }
- echo "<h1>THE DATA HAS BEEN SENT!!</h1>";
- mysql_close($conn);
- ?>
Add Comment
Please, Sign In to add comment