Using MySQL connector

So I'm starting to use this relatively new connector and there's not much information on internet, I managed to record some data n a database using a DHT11, however, when I try to record data on 2 or more tables, everything goes to hell. Here's a snippet of my code, maybe I'm too dumb and I can't see something actually obvious. The manual of this library does not exemplify how to record on different tables at a time, but, again, maybe I'm an actual dumb:

char INSERT_DHT = "INSERT INTO test_arduino.dht (temperature, humidity) VALUES (%s, %s)";
char INSERT_LDR = "INSERT INTO test_arduino.ldr (value) VALUES (%s)";
char query[128];
char temperature[10];
char humidity[10];
char value[10];


MySQL_Cursor *cur_mem = new MySQL_Cursor(&cn);
dtostrf(t, 1, 1, temperature);
dtostrf(h, 1, 1, humidity);
sprintf(query, INSERT_DHT, temperature,humidity);
delete cur_mem;

dtostrf(valueLDR, 1, 1, value);
sprintf(query, INSERT_LDR, value);
delete cur_mem;

So, when I run it, only one value is recorded on table dht, then nothing else happens. I'm using an UNO so maybe I'm running out of memory, but that's why I clear the used memory before it goes to the next query. Any help? plz?

I found the examples for your library MySQL_Connector_Arduino/examples at master · ChuckBell/MySQL_Connector_Arduino · GitHub use the example MySQL_Connector_Arduino and add my code below then change the line 77 from cur_mem->execute(INSERT_SQL); to cur_mem->execute(buffer2);

and i don’t like how you are joining your variables, i made you a sketch to show you how to join two floats and a comma into one char variable and then into and insert statment to use in your curl code , i have tested the sketch for over an hour it’s perfectly stable memory wise. enjoy and good luck.

char floatstring[16];  // char for floats
float tempC = 26.25; // fake sensor reading
float humC = 40.70; // fake sensor reading
char buffer[8] = {0}; // place to store converted float
char comma[] = ",";
char INSERT_DHT[] = "INSERT INTO test_arduino.dht (temperature, humidity) VALUES (";
char buffer2[128] = {0}; // main buffer for final output
char bracket[] = ")";

void setup() {

void loop() {
  if (humC > 99.99) { // if float reading go above 99 set to default
    tempC = 26.25; 
    humC = 40.70;
  // put your main code here, to run repeatedly:
  dtostrf(tempC, 5, 2, buffer); // float - char array len - float precicion - storage char 
  strcat(floatstring, buffer); // storage char - temp char sensor value from dtostrf 
  strcat (floatstring, comma);
  dtostrf(humC, 5, 2, buffer); // "decimal to string float"
  strcat (floatstring, buffer);
  strcat (buffer2,INSERT_DHT);
  strcat (buffer2,floatstring);
  strcat (buffer2,bracket);
  // cur_mem->execute(buffer2);  // <-- uncomment this when you use it in your sketch
  floatstring[0] = (char)0; // clears char array !
  buffer2[0] = (char)0; // clears char array !
  tempC = tempC + 0.05; // add a amount to the float values so show changes and test stability
  humC = humC + 0.05;
  delay(3000); // delay to stop spamming

Why do i do these things for free :confused:

@oscar_ovb, you are deleting the cursor and then trying to use it again immediately afterwards. So either don't delete it until you have completed both inserts, or create a new cursor for the second insert.