Posting Data into MySQL - Invalid Operators

Hi there, I've adopted some of my old code into new code to create a data logger. I'm looking to read data from 6 sensors and post it into a table in MySQL. I've found some guides on instructables and tried to adopt my code. However I get an invalid operator on the line data= (or line 58). It's flagging up on the bit I have copied though - does anyone have any idea why?

void loop(){

	currentMillis = millis();
	if(currentMillis - previousMillis > interval) { // READ ONLY ONCE PER INTERVAL
		previousMillis = currentMillis;
    p1 = (int) readPressure1();
    p2 = (int) readPressure2();
    p3 = (int) readPressure3();
    p4 = (int) readPressure4();
    p5 = (int) readPressure5();
    p6 = (int) readPressure6();
	}

	data = "p1=" + p1 + "&p2=" + p2 + "&p3=" + p3 + "&p4=" + p4 + "&p5=" + p5 + "&p6=" + p6;

	if (client.connect("www.datalogger.com",80)) { // REPLACE WITH YOUR SERVER ADDRESS
		client.println("POST /add.php HTTP/1.1"); 
		client.println("Host: 192.168.131.207"); // SERVER ADDRESS HERE TOO
		client.println("Content-Type: application/x-www-form-urlencoded"); 
		client.print("Content-Length: "); 
		client.println(data.length()); 
		client.println(); 
		client.print(data); 
	} 

	if (client.connected()) { 
		client.stop();	// DISCONNECT FROM THE SERVER
	}

	delay(300000); // WAIT FIVE MINUTES BEFORE SENDING AGAIN
}

I've attached my script if you like to see the whole picture.

client.ino (11.1 KB)

does anyone have any idea why?

Sure. The right side of the = sign is evaluated, and the result stored in the variable on the right.

Grab your calculator, and add "p1=" and the value in p1. What did you get? Post a picture of the screen.

The + is NOT a "concatenate these data elements, automatically converting ints to strings as needed" operator.

The sprintf() function CAN do that.

Actually, according to https://www.arduino.cc/en/Tutorial/StringAdditionOperator
you can use the + Operator to concatenate strings.

I would suggest, simply for test purposes, reducing line 58 to date = "p1=".

Add in Piece by Piece until you get the error. Does that give any insight?

Actually, according to https://www.arduino.cc/en/Tutorial/StringAdditionOperator
you can use the + Operator to concatenate strings.

That applies ONLY if there are Strings involved. "p1=" is a string, NOT a String.