expected unqualified-id before 'if' if {(!client.connected() && lastConnected)}

#include <SPI.h>
#include <Ethernet.h>
#include <Timer.h>
#include <PulseSensorPlayground.h>

Timer t;
PulseSensorPlayground pulseSensor;

int pin = A1; // analog pin
int tempc = 0,tempf=0; // temperature variables
int samples[8]; // variables to make a better precision
int maxi = -100,mini = 100; // to start max/min temperature
int i;
const int PulseWire = A0; // PulseSensor PURPLE WIRE connected to ANALOG PIN 0
const int LED13 = 13; // The on-board Arduino LED, close to PIN 13.
int Threshold = 550; //for heart rate sensor
float myTemp;
int myBPM;
String BPM;
String temp;
int error;
int panic;
int raw_myTemp;
float Voltage;
float tempC;

// Local Network Settings
byte mac[] = { 0xD4, 0xA8, 0xE2, 0xFE, 0xA0, 0xA1 }; // Must be unique on local network
byte ip[] = { 192,168,0,150 }; // Must be unique on local network
byte gateway[] = { 192,168,0,1};
byte subnet[] = { 255, 255, 255, 0 };

// ThingSpeak Settings
char thingSpeakAddress[] = "api.thingspeak.com";
String writeAPIKey = "UVGOLIA40B9YHKU8"; // Write API Key for a ThingSpeak Channel
const int updateInterval = 10000; // Time interval in milliseconds to update ThingSpeak

// Variable Setup
long lastConnectionTime = 0;
boolean lastConnected = false;
int failedCounter = 0;

// Initialize Arduino Ethernet Client
EthernetClient client;

void setup()
{

Serial.begin(9600);
Ethernet.begin(9600);
pulseSensor.analogInput(PulseWire);
//auto-magically blink Arduino's LED with heartbeat.
pulseSensor.setThreshold(Threshold);
if (pulseSensor.begin()) {
Serial.println("We created a pulseSensor Object !"); //This prints one time at Arduino power-up, or on Arduino reset.
}
delay(1000);
Serial.print("ETHERNET SHIELD ip is : ");
Serial.println(Ethernet.localIP());
// Start Ethernet on Arduino
void startEthernet();

}

void loop()
{

tempc = ( 5.0 * analogRead(1) * 100.0) / 1024.0;

String analogPin1 = String(tempc);

// Print Update Response to Serial Monitor
if (client.available())
{
char c = client.read();
Serial.print(c);
int myBPM = pulseSensor.getBeatsPerMinute(); // Calls function on our pulseSensor object that returns BPM as an "int".
// "myBPM" hold this BPM value now.
if (pulseSensor.sawStartOfBeat()) { // Constantly test to see if "a beat happened".

Serial.println(myBPM); // Print the value inside of myBPM.
}

delay(20);
char buffer1[10];
char buffer2[10];
BPM = dtostrf(myBPM, 4, 1, buffer1);
temp = dtostrf(tempC, 4, 1, buffer2);
}

void panic_button();
start: //label
error=0;
t.update();
//Resend if transmission is not completed
if (error==1)
{
goto start; //go to label "start"
}
delay(4000);

};

// Disconnect from ThingSpeak

if {(!client.connected() && lastConnected)

Serial.println();
Serial.println("...disconnected.");
Serial.println();

client.stop();
};

// Update ThingSpeak

else if{(!client.connected() && (millis() - lastConnectionTime > updateInterval))

updateThingSpeak("field1="+analogPin0);
updateThingSpeak("field2="+analogPin1);
updateThingSpeak("field3="+digitalPin8);

};

lastConnected = client.connected();
}

void updateThingSpeak(String tsData)
{
if (client.connect(thingSpeakAddress, 80))
{
client.print("POST /update HTTP/1.1\n");
client.print("Host: api.thingspeak.com\n");
client.print("Connection: close\n");
client.print("X-THINGSPEAKAPIKEY: "+UVGOLIA40B9YHKU8+"\n");
client.print("Content-Type: application/x-www-form-urlencoded\n");
client.print("Content-Length: ");
client.print(tsData.length());
client.print("\n\n");

client.print(tsData);

lastConnectionTime = millis();

if (client.connected())
{
Serial.println("Connecting to ThingSpeak...");
Serial.println();

failedCounter = 0;
}
else
{
failedCounter++;

Serial.println("Connection to ThingSpeak failed ("+String(failedCounter, DEC)+")");
Serial.println();
}

}
else
{
failedCounter++;

Serial.println("Connection to ThingSpeak Failed ("+String(failedCounter, DEC)+")");
Serial.println();

lastConnectionTime = millis();
}
}

void startEthernet()
{

client.stop();

Serial.println("Connecting Arduino to network...");
Serial.println();

delay(1000);

// Connect to network amd obtain an IP address using DHCP
if (Ethernet.begin(mac) == 0)
{
Serial.println("DHCP Failed, reset Arduino to try again");
Serial.println();
}
else {
Serial.println("Arduino connected to network using DHCP");
Serial.println();
Serial.println("Data being uploaded to THINGSPEAK Server.......");
Serial.println();
}

delay(1000);
}

Please read this before posting a programming question and follow the advice that it contains about posting code and error messages

Your braces are mixed up so that if statement isn't inside a function.

Also if statements should look like this

if (...){...}

but some of yours look like this

if {(...)...}

start: //label
    error=0;
   t.update();
    //Resend if transmission is not completed
    if (error==1)
    {
      goto start; //go to label "start"
    }

This is a messy equivalent for:

  // Resend until transmission is successful
  do
  {
    error = 0;
    t.update();
  } while (error == 1);
 int myBPM;

 // Print Update Response to Serial Monitor
  if (client.available())
  {
    char c = client.read();
    Serial.print(c);
    int myBPM = pulseSensor.getBeatsPerMinute();  // Calls function on our pulseSensor object that returns BPM as an "int".

It is a really crappy idea having two variables with the same name but different scopes.

The function does NOT return an "int". It returns an int.

    BPM = dtostrf(myBPM, 4, 1, buffer1);

myBPM is an int. dtostrf() expects a float. Why are you passing it an int, and expecting it to create a string with one decimal place?

And still with the stupid gotos.