Hallo,
könnte mal Hilfe gebrauchen.
Ich sende einen Wert aus einemArduinoprogramm an eine Datenbank.
Bekomme aber eine Fehlermeldung
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')
VALUES('2014-09-12 13:00:08', '427.00')' at line 1
Das ist meine PHP-Datei:
Hier die komplette Meldung die am Monitor ausgegeben wird:
Ethernet initialisieren...
429 cm
Verbunden, Sende Daten...
GET /ultraarduinodb.php
?entfernung=429.00
&key=solong HTTP/1.1
Host: ursprungwetter.de
User-Agent: Arduino
Connection: close
HTTP/1.1 200 OK
Date: Fri, 12 Sep 2014 10:58:55 GMT
Server: Apache/2.2.27 (Unix)
X-Powered-By: PHP/5.3.29
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html
f7
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Arduino Ultra PHP</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
f5
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>ultradb.inc.php</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
12
</body>
</html>
ca
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')
VALUES('2014-09-12 12:58:55', '429.00')' at line 1
0
'entfernung' ist der Wert der übergeben wird.
Kann mir bitte jemand einen Tipp geben?
Grüsse Bernd
könnte mal Hilfe gebrauchen.
Ich sende einen Wert aus einemArduinoprogramm an eine Datenbank.
Bekomme aber eine Fehlermeldung
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')
VALUES('2014-09-12 13:00:08', '427.00')' at line 1
Das ist meine PHP-Datei:
PHP-Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Arduino Ultra PHP</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
include("ultradb.inc.php");
$conn = mysql_connect(DB_SERVER, DB_USER, DB_PASSWORD);
if(is_resource($conn))
{
mysql_select_db(DB_NAME, $conn);
mysql_query("SET NAMES 'utf8'", $conn);
mysql_query("SET CHARACTER SET 'utf8'", $conn);
}
define("KEY","solong");
if(isset($_GET['key']))
{
if($_GET['key'] == KEY)
{
if($_GET['entfernung'])
{
$DATUM = date("Y-m-d H:i:s");
$ENTFERNUNG = mysql_real_escape_string($_GET['entfernung']);
$result = mysql_query("INSERT INTO arduino_schnee (datumzeit, entfernung,)
VALUES('".$DATUM."', '".$ENTFERNUNG."') ") or die(mysql_error());
if(mysql_affected_rows() == 1)
{
$result = "Schneehöhe gespeichert";
} else $result = "Fehler beim speichern der Daten in der MySQL-Datenbank";
} else $result = "Keine Schneehöhe übergeben";
} else $result = "Falscher Key";
} else $result = "Kein Key übergeben";
print_r($result);
?>
</body>
</html>
Ethernet initialisieren...
429 cm
Verbunden, Sende Daten...
GET /ultraarduinodb.php
?entfernung=429.00
&key=solong HTTP/1.1
Host: ursprungwetter.de
User-Agent: Arduino
Connection: close
HTTP/1.1 200 OK
Date: Fri, 12 Sep 2014 10:58:55 GMT
Server: Apache/2.2.27 (Unix)
X-Powered-By: PHP/5.3.29
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html
f7
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Arduino Ultra PHP</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
f5
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>ultradb.inc.php</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
12
</body>
</html>
ca
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')
VALUES('2014-09-12 12:58:55', '429.00')' at line 1
0
'entfernung' ist der Wert der übergeben wird.
Kann mir bitte jemand einen Tipp geben?
Grüsse Bernd
Kommentar