Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ####### Code for values.php
- <?php
- $host = "localhost";
- $db_name = "test";
- $username = "root";
- $password = "";
- $con = mysqli_connect($host,$username,$password,$db_name);
- $reading= $_GET['id'];//getting the sensor value and storing it in $reading variable
- $sql="INSERT INTO `gayzer`(`ID`, `DATE`, `TIME`,`READING`) VALUES ('',NOW(),NOW(),$reading)";// NOW() function is in MySQL returns the current date and time accoring to the column specification.this is a MySQL query.
- if ($con->query($sql) === TRUE) // if the current query is correctly written execute it and $con->query ($sql) executes the query and returns true if query executes successfully;
- {
- echo "New record created successfully";
- }
- else
- {
- echo "Error: " . $sql . "<br>" . $con->error;
- }
- $con->close();//closing connection
- ?>
Add Comment
Please, Sign In to add comment