Advertisement
frankiepankie

Add MySQL data from Arduino GET request

Aug 13th, 2014
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. <?php
  2.     // Connect to MySQL
  3. $MyUsername = "arduino";  // enter your username for mysql
  4. $MyPassword = "arduino";  // enter your password for mysql
  5. $MyHostname = "localhost";      // this is usually "localhost" unless your database resides on a different server
  6.  
  7. $dbh = mysql_pconnect($MyHostname , $MyUsername, $MyPassword);
  8. $selected = mysql_select_db("p1",$dbh);
  9.  
  10.         // Prepare the SQL statement
  11.         $SQL = "INSERT INTO p1.readings (id, time, laag_tarief, hoog_tarief, huidig_verbruik, gas) VALUES (NULL, NULL, '".$_GET["mEVLT"]."', '".$_GET["mEVHT"]."', '".$_GET["mEAV"]."', '".$_GET["mG"]."')";    
  12.  
  13.         // Execute SQL statement
  14.         mysql_query($SQL);
  15.  
  16.     // Go to the review_data.php
  17.     //header("Location: review_data.php");
  18. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement