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

    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘