Sending arduino sensor data via WiFi to a MySQL server
So I don't quite know why, but I started from scratch and it works now. I've put the new code below in case it helps someone in my situation.
// Arduino Low Power - Version: Latest 
//#include &lt;ArduinoLowPower.h&gt;
//#include &lt;ArduinoIoTCloud.h&gt;
#include &quot;thingProperties.h&quot;
#include &lt;Arduino_MKRENV.h&gt;
/*
  Repeating Wifi Web Client

  This sketch connects to a a web server and makes a request
  using a WiFi equipped Arduino board.

  created 23 April 2012
  modified 31 May 2012
  by Tom Igoe
  modified 13 Jan 2014
  by Federico Vanzati

  http://www.arduino.cc/en/Tutorial/WifiWebClientRepeating
  This code is in the public domain.
*/

#include &lt;SPI.h&gt;
#include &lt;WiFiNINA.h&gt;

int status = WL_IDLE_STATUS;

// Initialize the Wifi client library
WiFiClient client;

void setup() {
  //Initialize serial and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // check for the WiFi module:
  if (WiFi.status() == WL_NO_MODULE) {
    Serial.println(&quot;Communication with WiFi module failed!&quot;);
    // don't continue
    while (true);
  }

  String fv = WiFi.firmwareVersion();
  if (fv &lt; WIFI_FIRMWARE_LATEST_VERSION) {
    Serial.println(&quot;Please upgrade the firmware&quot;);
  }

  // attempt to connect to Wifi network:
  while (status != WL_CONNECTED) {
    //Serial.print(&quot;Attempting to connect to SSID: &quot;);
    //Serial.println(SSID);
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    status = WiFi.begin(SSID, PASS);

    // wait 10 seconds for connection:
    delay(10000);
  }
  // you're connected now, so print out the status:
  //printWifiStatus();
  //Start arduino cloud.
  //ArduinoCloud.begin(ArduinoIoTPreferredConnection);
  //Begin ENV shield.
  if (!ENV.begin()) {
    Serial.println(&quot;Failed to initialize MKR ENV shield!&quot;);
    while (1);
  }
}

void loop() {
  //ArduinoCloud.update();
  // if there's incoming data from the net connection.
  // send it out the serial port.  This is for debugging
  // purposes only:
  while (client.available()) {
    char c = client.read();
    Serial.write(c);
  }
    //Serial.println(&quot;Start reading sensors.&quot;);
    relativeHumidity = int(ENV.readHumidity());
    //Serial.println(relativeHumidity);
    lightIntensity = int(ENV.readIlluminance());
    //Serial.println(lightIntensity);
    airPressure = int(ENV.readPressure(MILLIBAR));
    //Serial.println(airPressure);
    temperature = int(ENV.readTemperature());
    //Serial.println(temperature);
    UV_Index = int(ENV.readUVIndex());
    //Serial.println(UV_Index);
    if (digitalRead(2) == LOW) {
      rain = 1;
    } else if (digitalRead(2) == HIGH) {
      rain = 0;
    }
    //Serial.println(rain);
    //Serial.println(&quot;Sensor data read.&quot;);
    //Serial.println(&quot;Start http request.&quot;);
    httpRequest();
    //Serial.println(&quot;Stop http request&quot;);
    delay(60000);
}

// this method makes a HTTP connection to the server:
void httpRequest() {
  // close any connection before send a new request.
  // This will free the socket on the Nina module
  client.stop();

  // if there's a successful connection:
  if (client.connect(server, 80)) {
    //Serial.println(&quot;connecting...&quot;);
    // send the HTTP PUT request:
    client.print(&quot;GET /weather_data.php?temp=&quot;);
    client.print(temperature);
    client.print(&quot;&amp;pressure=&quot;);
    client.print(airPressure);
    client.print(&quot;&amp;humidity=&quot;);
    client.print(relativeHumidity);
    client.print(&quot;&amp;illumination=&quot;);
    client.print(lightIntensity);
    client.print(&quot;&amp;UV_Index=&quot;);
    client.print(UV_Index);
    client.print(&quot;&amp;rain=&quot;);
    client.print(rain);
    client.print(&quot; &quot;);
    client.println(&quot;HTTP/1.1&quot;);
    client.println(&quot;Host: 192.168.0.29&quot;);
    client.println(&quot;User-Agent: ArduinoWiFi/1.1&quot;);
    client.println(&quot;Connection: close&quot;);
    client.println();
  } else {
    // if you couldn't make a connection:
    //Serial.println(&quot;connection failed&quot;);
  }
}


void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print(&quot;SSID: &quot;);
  Serial.println(WiFi.SSID());

  // print your board's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print(&quot;IP Address: &quot;);
  Serial.println(ip);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print(&quot;signal strength (RSSI):&quot;);
  Serial.print(rssi);
  Serial.println(&quot; dBm&quot;);
}