dsa88886666 2016-06-21 13:47
浏览 948

将Arduino主数据保存在数据库中

I want to save the sensor data in my database. Therefore I want to do a GET request to a php file where I compare the uuid's. That's just to look if this arduino already exists in the database. If this Uuid does not exist than I want to do a new entry.

Have someone ideas how to realize that?

As I said before, I thought about doing a get request to the php file on my webserver but this wasn't successfull. Beceause I havent a static UUID. Therefore I need to hardcode it into my arduino and I also dont know how to do that.

PHP-File Arduino Code

  • 写回答

1条回答

  • dongqu2863 2016-10-27 13:00
    关注

    cool project. I spot several locations where your issues could be coming from.

    In your php code you expect the parameters sensorType, batteryState, onlineState, sending, frequency, sensorDateTimeId and value to be available as get parameters,yet in your arduino code, you're not sending any of those, you're only sending a uuid.

    in you php code, you're using variable $uuid, yet you're not populating it anywhere.

    you're trying to use mysql_real_escape_string on a array, that will lead to a error. Besides, mysql_real_escape_string is deprecated,and even removed from php in php7. you'd better use other libraries to communicate with mysql. you can for instance have a look at this tutorial: http://codular.com/php-mysqli

    If you fix all of those errors, you can try your php code first, before moving on to the arduino code. you should be able to try it by just calling the php page from a browser in this way:

    http://yourserver/easy2sense/phpfiles/sensor_connection.php?uuid=12345&sensorType=1&batteryState=2&onlineState=3&sending=4&frequency=5&sensorDateTimeId=6&value=7

    评论

报告相同问题?

悬赏问题

  • ¥20 iqoo11 如何下载安装工程模式
  • ¥15 flask项目,怎么使用AJAX传数据库数据到echarts图表的data里,实现异步加载数据。
  • ¥15 本题的答案是不是有问题
  • ¥15 关于#r语言#的问题:(svydesign)为什么在一个大的数据集中抽取了一个小数据集
  • ¥15 C++使用Gunplot
  • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?
  • ¥15 蓝桥杯单片机第十三届第一场,整点继电器吸合,5s后断开出现了问题