I would like to insert data from two variables to MySQL.
Here is my code:
<?php
// Prepare variables for database connection
$dbusername = "arduino"; // enter database username, I used "arduino" in step 2.2
$dbpassword = "arduinotest"; // enter database password, I used "arduinotest" in step 2.2
$server = "localhost"; // IMPORTANT: if you are using XAMPP enter "localhost", but if you have an online website enter its address, ie."www.yourwebsite.com"
// Connect to your database
$dbconnect = mysql_pconnect($server, $dbusername, $dbpassword);
$dbselect = mysql_select_db("test",$dbconnect);
// Prepare the SQL statement
$sql = "INSERT INTO test.sensor (homero, parat) VALUES ('".$_GET["homero"].", ".$_GET["parat"]."')";
// Execute SQL statement
mysql_query($sql); ?>
And when I click on http://localhost/write_data.php?homer=32¶t=43 it wont send any data to my database. Please can you help me? Is $sql line correct? thanks