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

将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 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程