I have just connected a Libelium shield to connect many sensors to Arduino UNO, that measure water ph level, temperature,...etc. I really couldn't figure out how do I upload the sensor data into a database(MySQL). I have the code for database connectivity, but still couldn't figure out how(Querying) to upload the sensor data into the database.
The main problem here is how do I make the arduino recognize the sensor data to upload it into database or send to to another Arduino or Raspberry pi through XBee.
Code for database connectivity:
void sendData(){
Serial.println("Connecting...");
if (my_conn.mysql_connect(server_addr, 3306, user, password)){
delay(500);
Serial.println("Starting SQL!");
Serial.println(INSERT_SQL);
my_conn.cmd_query(INSERT_SQL);
Serial.println("Query Success!");
my_conn.disconnect();
Serial.println("\n");
}
else {
Serial.println("Connection failed!");
}
}