ESPBasic with Mysql
Posted: Sun Dec 06, 2015 2:55 pm
Can i read and write a mysql server?
-->
Open Community Forum for ESP8266, Come share Arduino and IoT (Internet of Things)
https://www.esp8266.com/
wget(yourdomain.com/examples/myscript.php?name=Peter&age=25)
<?
$host = "MyDBServer.com";
$db = "dbname";
$user = "user";
$pw = "password";
$con = mysql_connect($host,$user,$pw) or die(mysql_error());
mysql_select_db($db) or die(mysql_error());
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET NAMES 'utf8'");
$name = $_GET["name"];
$age = $_GET["age"];
$res = mysql_query("Insert into Persons (name, age) VALUES ('$name', $age)");
print ("I have inserted $name and $age in my table");
?>