Hi, Im trying to connect my Arduino Uno to PHP but it doesnt work, my connecting works i think.
But when i try to send data to my database i dont see anything in my database or my phpfile.
Here is my code of arduino and php:
Hi, Im trying to connect my Arduino Uno to PHP but it doesnt work, my connecting works i think.
But when i try to send data to my database i dont see anything in my database or my phpfile.
Here is my code of arduino and php:
Here is my code of arduino and php:
Can you please post the code rather than pictures of it.
void connectionPHP(){
if (client.connect(server, 80))
{
Serial.print("-> Connected");
client.print("GET /Huisarts/phpconnection.php? HTTP/1.1");
client.print("Host: 192.168.1.177:80");
client.print("asv=");
client.print(averageSensorValue);
client.print(server[0]);
client.print(".");
client.print(server[1]);
client.print(".");
client.print(server[2]);
client.print(".");
client.print(server[3]);
client.print(".");
client.println("Connection: close");
client.println();
client.println();
client.stop();
tellerVoorIntervalConnectionPHP = 0;
}
else {
Serial.println("geen connectie met de database");
}
}
And this is my php code:
<?php //echo ("update_db.php indicator"); $averageSensorValue = $_GET['asv']; //Connect to database $con = mysql_connect("localhost", "root", "root"); if(!$con) die('Could not connect: ' .mysql_error()); mysql_select_db("hartmetingen", $con); mysql_query("INSERT INTO hartmetingen(hartmetingen) VALUES ('$averageSensorValue')"); mysql_close($con); ?>