'client' was not declared in this scope. Please help!

I am trying to make a WiFi RFID reader using NodeMCU, MFRC522 and MS SQL Server

I used arduino examples along with this tutorial: Arduino Project Hub

and I modified the code to suit my need (only sending ID) and I also added wifi connection instead of ethernet

This is my arduino code:

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <SPI.h>
#include <MFRC522.h>

constexpr uint8_t RST_PIN = D3;     // Configurable
constexpr uint8_t SS_PIN = D4;     // Configurable 
 
MFRC522 rfid(SS_PIN, RST_PIN); // Instance of the class

MFRC522::MIFARE_Key key; 

// Init array that will store new NUID 
byte nuidPICC[4];

char server[] = "192.168.x.x";   //MY SERVER
IPAddress ip(192, 168, x, x);

// Replace with your network credentials
const char* ssid = "myssid";
const char* password = "mypassword";

 
void setup()
{
delay(1000);
Serial.begin(115200);
WiFi.begin(ssid, password); //begin WiFi connection
Serial.println("");
  
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
  delay(500);
  Serial.print(".");
 }
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());

  SPI.begin(); // Init SPI bus
  rfid.PCD_Init(); // Init MFRC522 

  for (byte i = 0; i < 6; i++) {
    key.keyByte[i] = 0xFF;
  }
}
void loop()
{
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());

// Look for new cards
if ( ! rfid.PICC_IsNewCardPresent())
  return;

// Verify if the NUID has been readed
if ( ! rfid.PICC_ReadCardSerial())
  return;
  
if (rfid.uid.uidByte[0] != nuidPICC[0] || 
  rfid.uid.uidByte[1] != nuidPICC[1] || 
  rfid.uid.uidByte[2] != nuidPICC[2] || 
  rfid.uid.uidByte[3] != nuidPICC[3] ) {
  Serial.println(F("A new card has been detected."));

  // Store NUID into nuidPICC array
  for (byte i = 0; i < 4; i++) {
    nuidPICC[i] = rfid.uid.uidByte[i];
  }
   
  Serial.println(F("The NUID tag is:"));
  Serial.print(F("In hex: "));
  printHex(rfid.uid.uidByte, rfid.uid.size);
  Serial.println();
  Serial.print(F("In dec: "));
  printDec(rfid.uid.uidByte, rfid.uid.size);
  Serial.println();
  Sending_To_DB();
}
else Serial.println(F("Card read previously."));

// Halt PICC
rfid.PICC_HaltA();

// Stop encryption on PCD
rfid.PCD_StopCrypto1();
}

 void Sending_To_DB()   //CONNECTING TO SQL SERVER
 {
   if (client.connect(server, 80)) {
    Serial.println("connected");
    // Make a HTTP request:
    client.print("C:\Users\User\Desktop/rfid_read.php?allow=");     //YOUR URL
    
    for(int s=0;s<4;s++)
      {
        client.print(rfid.uid.uidByte[s]);                      
      }
    client.print(" ");      //SPACE BEFORE HTTP/1.1
    client.print("HTTP/1.1");
    client.println();
    client.println("Host: 192.168.x.x");
    client.println("Connection: close");
    client.println();
    } 
  else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
  client.stop();
 }
/**
 * Helper routine to dump a byte array as hex values to Serial. 
 */
void printHex(byte *buffer, byte bufferSize) {
  for (byte i = 0; i < bufferSize; i++) {
    Serial.print(buffer[i] < 0x10 ? " 0" : " ");
    Serial.print(buffer[i], HEX);
  }
}

/**
 * Helper routine to dump a byte array as dec values to Serial.
 */
void printDec(byte *buffer, byte bufferSize) {
  for (byte i = 0; i < bufferSize; i++) {
    Serial.print(buffer[i] < 0x10 ? " 0" : " ");
    Serial.print(buffer[i], DEC);
  }
}

When I verify the code I get this error: 'client' was not declared in this scope.
the error points at client.stop() that last line of the Sending_To_DB() code
Can anyone please help me fix this issue?

Can anyone please help me fix this issue?

If we see the WHOLE error message, yes. You get to see the line number where the compiler has issues. You didn't share that.

You do try to use an instance named client in Sending_To_DB(), but I don't see where that instance is created/defined.

Where is 'client' declared? If it is declared inside a function, are you trying to use it inside a different function? That would be "out of scope". If it is not declared at all, that would also be "out of scope".

PaulS:
If we see the WHOLE error message, yes. You get to see the line number where the compiler has issues. You didn't share that.

You do try to use an instance named client in Sending_To_DB(), but I don't see where that instance is created/defined.

I just added WiFiClient client; and the error was gone. Silly mistake! Thanks so much for pointing that out.