Pull PHP data using Arduino Ethernet Shield

I would like to pull data from a PHP script that says a record already exists and display it to my 16x2 LCD display. I am able to push data to the PHP script and use the data to check whether a record exist or not. If not, a record will be added. Then if a record already exists, I would like my PHP script to send data to the Arduino and use it to display something. But I cannot seem to get how to display “Already Exists!” if my PHP file echoes something it goes right through “Attendance Recorded!”.

PHP Code:

$cardID = $_GET['uid'];

function checkAttendance($conn, $stud_id){
    $check = mysqli_query($conn, "SELECT * FROM tbl_attendance WHERE student_id = '$stud_id' AND date = CURDATE()") or die (mysqli_error());
    
    if (mysqli_num_rows($check) > 0){
        return true;
    }
    
    else {
        return false;
    }
}

function recordAttendance($conn, $sid, $gid, $glid, $scid){
    $sql = mysqli_query($conn, "INSERT INTO tbl_attendance(student_id, guardian_id, gradeLevel_id, section_id, date, arrival_time, status) VALUES ('".$sid."', '".$gid."', '".$glid."', '".$scid."', CURDATE(), CURTIME(), 'P')")or die(mysqli_error());
}

$res = mysqli_query($connect, "SELECT * FROM tbl_student WHERE card_id = '$cardID'")or die(mysqli_error());

    while($row = mysqli_fetch_array($res,MYSQLI_ASSOC)){
        if (checkAttendance($connect, $row['student_id'])){
            echo "Already Exist!";
        } 
        else {
            recordAttendance($connect, $row['student_id'], $row['guardian_id'], $row['gradeLevel_id'], $row['section_id']);
        }
    }

Arduino Code:

void setup() {
  Serial.begin(9600);   // Initialize serial communications with the PC
  while (!Serial);    // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)
  Ethernet.begin(mac);
  SPI.begin();      // Init SPI bus
  lcd.begin(16,2);
  mfrc522.PCD_Init();   // Init MFRC522
}

void loop() {

  //Time Display
  tmElements_t tm;
  if (RTC.read(tm)) {
    
    lcd.setCursor(0,0); //Start at character 0 on line 0
    print2digits(tm.Hour);
    lcd.print(':');
    print2digits(tm.Minute);
    
    lcd.setCursor(6,0); //Start at character 0 on line 1
    print2digits(tm.Day);
    lcd.print('/');
    print2digits(tm.Month);
    lcd.print('/');
    lcd.print(tmYearToCalendar(tm.Year));
  } 
  delay(990);

  lcd.setCursor(0,1);
  lcd.print("  CKC IBED AMS");
  delay(150);
  
  //RFID Read
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent()) {
    return;
  }

  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) {
    return;
  }

  //digitalWrite(buzzerPin, HIGH);
  //delay(500);
  //digitalWrite(buzzerPin, LOW);
  
 UID = "";
 for (int i = 0; i < mfrc522.uid.size; i++) {  // 
    readCard[i] = mfrc522.uid.uidByte[i];
    UID.concat(String(mfrc522.uid.uidByte[i], HEX)); // Adds the 4 bytes in a single String variable
    
  }
  UID.toUpperCase();
  lcd.setCursor(0,1);
  lcd.print("                ");
  delay(250);
  lcd.setCursor(0,1);
  lcd.print("Checking ID...");
  delay(250);
  lcd.setCursor(0,1);
  lcd.print("                ");
  lcd.setCursor(0,1);

  if (client.connect(server, 80)) {
    // Make a HTTP request:
    client.print( "GET /ckcIbed/insertData.php?");
    client.print("uid=");
    client.print( UID );
    client.println( " HTTP/1.1");
    client.print( "Host: " );
    client.println(server);
    client.println( "Connection: close" );
    client.println();
    client.println();
    if (client.available()) {
         lcd.print("Already Exists!");
        } else {
             lcd.print("Attendance Recorded!");
     }
    client.stop();
  }
  else {
    // you didn't get a connection to the server:
    lcd.print("No Connection");
  }

  mfrc522.PICC_HaltA(); // Stop reading
  return 1;
  delay(250);
  lcd.print("                ");
}