0

I have just written this code o update my MYSQL Server with data from an Arduino Micro controller using Ethernet.

Basically I want to pass the variables collected by the Arduino to the Server.

Whenever I try to use this script the Values $_POST & $_POST do not get passed on!

http://localhost/Con.php?Name=Test_Sensor&Value=3333
<?php
$NAME = $_POST['Name'];
$DATA = $_POST['Value'];

$con = mysql_connect("localhost","root","rawraw");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("sensor-data", $con);

$sql = "INSERT INTO `sensor-data`.`Data_Log` (`Key`, `Date`, `Time`, `Sensor_Name`, `SensorValue`) VALUES (NULL,CURDATE(),CURTIME(),'$NAME','$DATA')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";

mysql_close($con)
?>

Cant figure out what I have done wrong!
Can anyone help?

Thanks in Advance

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by somedude3488
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.