Multi variables in select in MySQL

Hello great Arduino community.
I have used the MySQL example "Basic_select" and it works.
But I want to use it to show 4 different variables.
But the main mistake is
"Bad mojo. EOF found reading column header."
"ERROR: You must read the columns first!"
but with this I have it works for it shows nothing

I don't know if I missed something or if it just doesn't work.
P.S. I would use "Complex_select" but I don't need to graph them on an LCD and I use an ESP8266
Help

#include <ESP8266WiFi.h>
#include <WebSocketsServer.h>
#include <WiFiClient.h>
#include <FastIO.h>
#include <I2CIO.h>
#include <LCD.h>
#include <LiquidCrystal.h>
#include <LiquidCrystal_I2C.h>
#include <LiquidCrystal_SR.h>
#include <LiquidCrystal_SR2W.h>
#include <LiquidCrystal_SR3W.h>
#include <Wire.h>
#include <MySQL_Connection.h>
#include <MySQL_Cursor.h>


LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7,3, POSITIVE);
WiFiClient client;
MySQL_Connection conn((Client *)&client);
MySQL_Cursor cur = MySQL_Cursor(&conn);

extern "C" {
#include "user_interface.h"
#include "wpa2_enterprise.h"
}


IPAddress server_addr(192, ***, *, **);          // MySQL server IP ---------------DIRECCCION IPv4
char user[] = "*******";           // MySQL user
char pass[] ="*********";       // MySQL password

// SSID to connect to
static const char* ssid = "********";
// Username for authentification
static const char* username = "******";
// Password for authentication
static const char* password = "**********";

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9200);
    lcd.begin(16,2);

/*
   // WPA2 Connection starts here
  // Setting ESP into STATION mode only (no AP mode or dual mode)
    wifi_set_opmode(STATION_MODE);
    struct station_config wifi_config;
    memset(&wifi_config, 0, sizeof(wifi_config));
    strcpy((char*)wifi_config.ssid, ssid);
    wifi_station_set_config(&wifi_config);
    wifi_station_clear_cert_key();
    wifi_station_clear_enterprise_ca_cert();
    wifi_station_set_wpa2_enterprise_auth(1);
    wifi_station_set_enterprise_identity((uint8*)username, strlen(username));
    wifi_station_set_enterprise_username((uint8*)username, strlen(username));
    wifi_station_set_enterprise_password((uint8*)password, strlen(password));
    wifi_station_connect();
  // WPA2 Connection ends here*/

  // Normal Connection starts here
 
  WiFi.mode(WIFI_STA);
  Serial.write("\r\nConnect to WLAN");
  WiFi.begin(ssid, password);
  // Normal Connection ends here


  
  // Wait for connection AND IP address from DHCP
  Serial.println();
   lcd.setCursor(0,0);
  lcd.print("Conectando a red");
  Serial.println("Waiting for connection and IP Address from DHCP");
  while (WiFi.status() != WL_CONNECTED) {
    delay(4000);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
  
    lcd.print("Conectandose a DB");
  IPAddress myAddr = WiFi.localIP();
 while (conn.connect(server_addr, 3306, user, pass) != true) {
    delay(200);
    Serial.print ( "." );
  }

  Serial.println("");
  Serial.println("Connected to SQL Server!");  
}

void loop() {
char query1[] ="SELECT Capacidad FROM ***.*** where Notambo=1; ";
char query2[] ="SELECT Capacidad FROM ***.*** where Notambo=2; ";
char query3[] ="SELECT Capacidad FROM ***.*** where Notambo=3; ";
char query4[] ="SELECT Capacidad FROM ***.*** where Notambo=4; ";
  long head_count1 = 0;
  long head_count2 = 0;
  long head_count3 = 0;
  long head_count4 = 0;
    row_values *row = NULL;
  row_values *row2 = NULL;
  row_values *row3 = NULL;
  row_values *row4 = NULL;
  MySQL_Cursor *cur1_mem1 = new MySQL_Cursor(&conn);
  MySQL_Cursor *cur2_mem2 = new MySQL_Cursor(&conn);
  MySQL_Cursor *cur3_mem3 = new MySQL_Cursor(&conn);
  MySQL_Cursor *cur4_mem4 = new MySQL_Cursor(&conn);
  delay(1000);

  Serial.println("1) Demonstrating using a cursor dynamically allocated.");
  // Initiate the query class instance
MySQL_Cursor cur1 = MySQL_Cursor(&conn);
MySQL_Cursor cur2 = MySQL_Cursor(&conn);
MySQL_Cursor cur3 = MySQL_Cursor(&conn);
MySQL_Cursor cur4 = MySQL_Cursor(&conn);
  // Execute the query
  cur1_mem1->execute(query1);
  cur2_mem2->execute(query2);
  cur3_mem3->execute(query3);
  cur4_mem4->execute(query4);
  // Fetch the columns (required) but we don't use them.
  column_names *columns = cur1_mem1->get_columns();

  
  // Read the row (we are only expecting the one)
  do {
    row = cur1_mem1->get_next_row();
    if (row != NULL) {
      head_count1 = atol(row->values[0]);
    }
  } while (row != NULL);

  do {
    row2 = cur2_mem2->get_next_row();
    if (row2 != NULL) {
      head_count1 = atol(row2->values[0]);
    }
  } while (row2 != NULL);

  do {
    row3 = cur3_mem3->get_next_row();
    if (row3 != NULL) {
      head_count1 = atol(row3->values[0]);
    }
  } while (row3 != NULL);
  
  do {
    row4 = cur4_mem4->get_next_row();

    if (row4 != NULL) {
      head_count1 = atol(row4->values[0]);
    }
  } while (row4 != NULL);

  // Show the result
  lcd.setCursor(0,0);
  lcd.print("Cont=");
  lcd.print(head_count1);
  Serial.print("Cont= ");
  Serial.println(head_count1);

  lcd.setCursor(8,0);
  lcd.print("Ncon=");
  lcd.print(head_count2);
  Serial.print("Not cont= ");
  Serial.println(head_count2);
  
    lcd.setCursor(0,1);
  lcd.print("Filt=");
  lcd.print(head_count3);
  Serial.print("Filt= ");
  Serial.println(head_count3);

  lcd.setCursor(8,1);
  lcd.print("Chat=");
  lcd.print(head_count4);
  Serial.print("Chat= ");
  Serial.println(head_count4);
  delete cur1_mem1;
  delete cur2_mem2;
  delete cur3_mem3;
  delete cur4_mem4;
  delay(1000);
  
}

I'm not going to wade through a boat-load of commented out code to figure out what you are actually executing. Get rid of ALL the commented out code.

Having 4 queries that differ by one letter is the height of laziness. You should be able to dynamically construct the query to resolve the one letter difference.

You don't all the other duplicate variables, either.

Showing some actual output is going to be essential to resolving your problem.

Typically, though, you create a query, execute the query, extract the data, clean up, and THEN repeat. You do NOT try to mix 4 queries and response handling.

:0
It seems perfect. Only one thing, this variable can only be written once and occupy 4.
something to overwrite the variable

 column_names *columns = cur1_mem1->get_columns();

Only this and it's all

@PaulS

It seems perfect.

What does?

Only one thing, this variable can only be written once and occupy 4.

What variable? Occupies 4 what?

Why would the column names change because you pass 4 instead of 1 in the query? You are querying the same table, and, presumably, you know the column names.