Hi, I am working on a very important project and I would really need some help just to understand the right way to do it. So, basically I need to send a simple MySQL query to a database hosted by remotemysql.com(they host only the database). After some time, I've managed to get it working perfectly with a NodeMCU ESP8266 (Wifi Module)...But now I need to use the SIM900 to do the same thing. The problem is that I've looked all over the internet and there is not a clear answer. People are using php, but I don't need it, I just want to send the query (in a string format) to the remote database. So, here is the code that I wrote for the ESP8266, can you help me modify it to do the same thing with a SIM900? I would be extremely glad if you could help me...Thank you.
#include <ESP8266WiFi.h>
#include <MySQL_Connection.h>
#include <MySQL_Cursor.h>
IPAddress server_addr(37,59,55,185); // IP of the remotemysql.com website
char user[] = "*********"; // MySQL user login username
char password[] = "********"; // MySQL user login password
// WiFi card example
char ssid[] = "---------------"; // your SSID
char pass[] = "---------------"; // your SSID Password
WiFiClient client;
MySQL_Connection conn(&client);
MySQL_Cursor* cursor;
void setup()
{
Serial.begin(115200);
while (!Serial); // wait for serial port to connect. Needed for Leonardo only
// Begin WiFi section
Serial.printf("\nConnecting to %s", ssid);
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
timeClient.begin();
}
// print out info about the connection:
Serial.println("\nConnected to network");
Serial.print("My IP address is: ");
Serial.println(WiFi.localIP());
Serial.print("Connecting to SQL... ");
if (conn.connect(server_addr, 3306, user, password))
Serial.println("OK.");
else
Serial.println("FAILED.");
// create MySQL cursor object
cursor = new MySQL_Cursor(&conn);
}
void loop()
{
while(!Serial);
if (conn.connected())
{
char INSERT_SQL[120];
sprintf(INSERT_SQL, "INSERT INTO ys5oM1NyOx.users (code) VALUES ('AB12CD34')");
puts(INSERT_SQL);
cursor->execute(INSERT_SQL);
}
delay(5000);
}