Arduino + sim900a将数据保存到mysql表中 [英] Arduino + sim900a save data to mysql table

查看:221
本文介绍了Arduino + sim900a将数据保存到mysql表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Arduino Uno R3和SIMCOM900A,测试短信确定。现在我需要将数据插入Mypsql表。任何人都可以帮助我...没有数据插入到Mysql表中。

提前致谢..



我的尝试:



 在Arduino终端编码: 

AT

OK
AT + CIPSTATUS

OK

状态:IP INITIAL
AT + CIPSTART =TCP,122.160.112.220,80

OK

CONNECT OK
AT + CIPSEND

> GET / 122.160.112.220 / gprs_data.php?v1 = 2.3& v2 = 2.6 / HTTP 1.1(ctrl + m)(ctrl + j)
主机:122.160.112.220(ctrl + m)(ctrl + j) (CTRL + j)的?

发送确认





获取此信息:

 HTTP / 1.1 408请求超时
日期:星期二,2017年4月18日09:14:19 GMT
服务器:Apache / 2.2.22(Win32)PHP / 5.2。 4
内容长度:223
连接:关闭
内容类型:text / html; charset = iso-8859-1

<!DOCTYPE HTML PUBLIC - // IETF // DTD HTML 2.0 // EN>
< html>< head>
< title> 408请求超时< / title>
< / head>< body>
< h1>请求超时< / h1>
< p>等待来自客户端的HTTP请求的服务器超时。< / p>
< / body>< / html>

已关闭$ b $b⸮⸮⸮⸮









gprs_data.php代码:



<?php



 $ val1 = $ _GET ['v1']; 



 $ val2 = $ _GET ['v2 ']; 



 //插入记录
mysql_query(LOCK TABLES gprs_data WRITE;);
$ sql =INSERT INTO gprs_data(val1,val2)
VALUES
('$ val1','$ val1');

if(!mysql_query($ sql,$ con))
{
die('Error:'。mysql_error());
}

mysql_query(UNLOCK TABLES;);





?>

解决方案

val1 =


_GET ['v1'];



 


val2 =

I am using Arduino Uno R3 and SIMCOM900A,tested SMS ok. Now I need to insert data to Mypsql table.Can anyone help me... no data is inserted into the Mysql table.
Thanks in advance..

What I have tried:

coding in Arduino terminal:

AT

OK
AT+CIPSTATUS

OK

STATE: IP INITIAL
AT+CIPSTART="TCP","122.160.112.220","80"

OK

CONNECT OK
AT+CIPSEND

> GET/122.160.112.220/gprs_data.php?v1=2.3&v2=2.6 /HTTP 1.1 (ctrl+m)(ctrl+j)
HOST:122.160.112.220 (ctrl+m)(ctrl+j) (ctrl+j)

SEND OK



Getting this:

HTTP/1.1 408 Request Time-out
Date: Tue, 18 Apr 2017 09:14:19 GMT
Server: Apache/2.2.22 (Win32) PHP/5.2.4
Content-Length: 223
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>408 Request Time-out</title>
</head><body>
<h1>Request Time-out</h1>
<p>Server timeout waiting for the HTTP request from the client.</p>
</body></html>

CLOSED
⸮⸮⸮⸮





gprs_data.php code:

<?php

$val1 = $_GET['v1'];


$val2 = $_GET['v2'];


//insert record
mysql_query("LOCK TABLES gprs_data WRITE;");
$sql="INSERT INTO gprs_data (val1,val2)
VALUES
('$val1','$val1')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
  
 mysql_query("UNLOCK TABLES;"); 



?>

解决方案

val1 =


_GET['v1'];



val2 =


这篇关于Arduino + sim900a将数据保存到mysql表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆