arduino and mysql connection

Hello :relaxed: ,
i am trying to send data to mySql database.
therfore i use the program bellow.
but i don t know how to alter some lines.

the problem is that i connect my arduino uno with official wifi shield to a hotspot on a notebook(win7). also on this notebook i run the mysql database.

i have no clue what i have to type in the line for char server[]=....???
i suggest the ip of my laptop right?
next problem is in line for the port. i chose 80, the port for apache. or has there to be the port of mysql?
last question is how i write the right directory for php?
i think client.println("POST localhost/insert_mysql.php HTTP/1.1");

#include <SPI.h>
#include <WiFi.h>

char ssid[] = "hotspot";  
char password[] = "12345678";
int status = WL_IDLE_STATUS;
WiFiClient client;

// EDIT: 'Server' address to match your domain
char server[] = "178.202.228.171"; // This could also be 192.168.1.18/~me if you are running a server on your computer on a local network.

// This is the data that will be passed into your POST and matches your mysql column
int yourarduinodata = 999;
String yourdatacolumn = "yourdata=";
String yourdata;

void setup() {
  Serial.begin(9600);
  
  connectWifi();
  // You're connected now, so print out the status
  printWifiStatus();
  
  postData();
}

void loop() {

}

void connectWifi() {
  // Attempt to connect to wifi network
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to SSID: ");
    Serial.println(ssid);
    status = WiFi.begin(ssid, password);
    // Wait 10 seconds for connection
    Serial.print("Connection succesful!");
    delay(10000);
  }
}

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

  // Print your WiFi shield's IP address
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

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

// This method makes a HTTP connection to the server and POSTs data
void postData() {
  // Combine yourdatacolumn header (yourdata=) with the data recorded from your arduino
  // (yourarduinodata) and package them into the String yourdata which is what will be
  // sent in your POST request
  yourdata = yourdatacolumn + yourarduinodata;

  // If there's a successful connection, send the HTTP POST request
  if (client.connect(server, 80)) {  //What Port do i have to choose?
    Serial.println("connecting...");

    // EDIT: The POST 'URL' to the location of your insert_mysql.php on your web-host
    client.println("POST /insert_mysql.php HTTP/1.1");

    // EDIT: 'Host' to match your domain
    client.println("Host: www.yourdomain.com");
    client.println("User-Agent: Arduino/1.0");
    client.println("Connection: close");
    client.println("Content-Type: application/x-www-form-urlencoded;");
    client.print("Content-Length: ");
    client.println(yourdata.length());
    client.println();
    client.println(yourdata); 
  } 
  else {
    // If you couldn't make a connection:
    Serial.println("Connection failed");
    Serial.println("Disconnecting.");
    client.stop();
  }
}

i have no clue what i have to type in the line for char server[]=....???
i suggest the ip of my laptop right?

Yes.

String yourdatacolumn = "yourdata=";
String yourdata;

Wasteful. Learn to use strings (NULL terminated arrays of chars) instead.

    client.println("Host: www.yourdomain.com");
    client.println("User-Agent: Arduino/1.0");
    client.println("Connection: close");
    client.println("Content-Type: application/x-www-form-urlencoded;");
    client.print("Content-Length: ");
    client.println(yourdata.length());

Unless your PC is hosting multiple domains (highly unlikely), you don't need the Host line. You don't need the User-agent line. The default for the Connection attribute is close, so that is useless. Using a GET request is far simpler. None of the rest of that stuff would be needed.

next problem is in line for the port. i chose 80, the port for apache. or has there to be the port of mysql?

Are you trying to execute a script by making a GET/PUT/POST request, or are you trying to talk directly to MySQL? Looks like a POST request, but should/could be a GET request, to me. So, the httpd port is correct.

last question is how i write the right directory for php?
i think client.println("POST localhost/insert_mysql.php HTTP/1.1");

You think wrong. Localhost means the machine that is making the GET request. I'm nearly certain that you have NOT ported PHP to the Arduino.

You defined a directory where the stuff to be executed goes. When I did it, I set C:\Apache24\htdocs as the root directory. To execute a script that lives in that directory:

GET scriptName.ext HTTP/1.1

Or POST, if you must.

If you create a directory in the root directory, like uselessStuff, that contains thisIsCrap.php.

GET uselessStuff/thisIsCrap.php?name=value&anotherName=anotherValue HTTP/11