php - 通过 phpmyadmin Arduino 到 MySQL

标签 php mysql

编辑:2015 年 8 月 22 日 @ 22:44z

大家好,

我的“发布”和“显示”PHP 可以工作。我已经彻底检查了两者。我几乎可以肯定问题出在下面的代码中,只是不知道问题出在哪里。

问题是“为什么 arduino/wifishield 无法连接到由 phpmyadmin 管理的 NetSol 托管的 MySQL 数据库?”我已将 DB IP 地址、通行证、用户名等融入到 PHP 中。

这是我正在使用的 C 代码:

void postData() {
if (client.connect(server, 80)) {
Serial.println("connecting...");
client.println("POST /insert_mysql.php HTTP/1.1")
//I've verified this PHP connects to the DB via the IP address
client.println("Host: www.<my_website>.com"); //hosted by NetSol
client.println("User-Agent: Arduino/1.0"); //should this be 2.0?
client.println("Connection: close");
client.println("Content-Type: application/x-www-form-urlencoded;");
client.print("Content-Length: ");
client.println(yourdata.length());
client.println();
client.println(yourdata);
} 
else {
Serial.println("Connection failed");
Serial.println("Disconnecting.");
client.stop();
}
}

最佳答案

这是一个非常简单的解决方案......

1.) WiFi Shield 需要将固件升级到 1.1.0
2.) 防护罩的天线很弱,所以我必须获得更好的信号

关于php - 通过 phpmyadmin Arduino 到 MySQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32002311/

相关文章:

php 比较多维数组是否相等

php - 即使在 php 中设置时区后,服务器中的时间戳也会给出错误的时间

php - 多选引导插入数据库 Laravel

php - 如何使用键/值数组创建数组?

php - 将 Mongo 游标正确解析为 PHP

php - 如何修复 laravel 中的 gettallheaders.php 错误?

php - 如果我在表名后使用任何条件,表的最后一行不显示

php - OpenID : Which one I should use to index a user "openid_identity" or "openid_claimed_id"?

mysql - 如何在MySQL中查找当年的天数

php - 是否可以在 ajax 中将 POST 数据发送到另一个 php?