Arduino to MySQL + PHP + Ethernet Shield

Hello, i am trying to pass data from arduino to database via ethernet shield and i have some questions.

I am triying to pass the variables “BPM” and “t” that i read from two sensor to my database but i dont have a response.

I dont know if i need something that i cant see.

There is my code:

#include <Ethernet.h>
#include <DallasTemperature.h>

#define Pin 2 //Se declara el pin donde se conectará la DATA


OneWire ourWire(Pin); //Se establece el pin declarado como bus para la comunicación OneWire
 
DallasTemperature sensors(&ourWire); //Se instancia la librería DallasTemperature


//  Variables
int i=0;
int pulsePin = 0;                 // Pulse Sensor purple wire connected to analog pin 0
int blinkPin = 13;                // pin to blink led at each beat
int fadePin = 5;                  // pin to do fancy classy fading blink at each beat
int fadeRate = 0;                 // used to fade LED on with PWM on fadePin

// Volatile Variables, used in the interrupt service routine!
volatile int BPM;                   // int that holds raw Analog in 0. updated every 2mS
volatile int Signal;                // holds the incoming raw data
volatile int IBI = 600;             // int that holds the time interval between beats! Must be seeded! 
volatile boolean Pulse = false;     // "True" when User's live heartbeat is detected. "False" when not a "live beat". 
volatile boolean QS = false;        // becomes true when Arduoino finds a beat.

// Regards Serial OutPut  -- Set This Up to your needs
static boolean serialVisual = true;   // Set to 'false' by Default.  Re-set to 'true' to see Arduino Serial Monitor ASCII Visual Pulse 
float t=0;

byte mac[] = {  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
char server[] = "teleucab.esy.es"; // IP Address (or name) of server to dump data to

EthernetClient client;


void setup(){
  pinMode(blinkPin,OUTPUT);         // pin that will blink to your heartbeat!
  pinMode(fadePin,OUTPUT);          // pin that will fade to your heartbeat!
  Serial.begin(115200);             // we agree to talk fast!
  interruptSetup();                 // sets up to read Pulse Sensor signal every 2mS 
   // IF YOU ARE POWERING The Pulse Sensor AT VOLTAGE LESS THAN THE BOARD VOLTAGE, 
   // UN-COMMENT THE NEXT LINE AND APPLY THAT VOLTAGE TO THE A-REF PIN
//   analogReference(EXTERNAL); 
  sensors.begin(); //Se inician los sensores 

  delay(2000); 
}


//  Where the Magic Happens
void loop(){


  t = (float) sensors.getTempCByIndex(0);
    serialOutput() ;       
    
  if (QS == true){     // A Heartbeat Was Found
                       // BPM and IBI have been Determined
                       // Quantified Self "QS" true when arduino finds a heartbeat
        fadeRate = 255;         // Makes the LED Fade Effect Happen
                                // Set 'fadeRate' Variable to 255 to fade LED with pulse
        serialOutputWhenBeatHappens();   // A Beat Happened, Output that to serial.     
        QS = false;                      // reset the Quantified Self flag for next time    
  }
     
  ledFadeToBeat();                      // Makes the LED Fade Effect Happen


  
  delay(2000);                             //  take a break

  if (client.connect(server, 80)) {
    
    Serial.print("Temperatura="); 
    Serial.print(t); 
    Serial.print(" BPM =");
    Serial.println(BPM);
    // Envia el requerimiento al servidor via GET
    Serial.println("Iniciando conexion...");
    client.print( "GET /add_data.php?temp=");
    client.print(t);
    client.print("&amp;");
    client.print("bpm=");
    client.print(BPM);
    client.println( " HTTP/1.1");
    client.println("Host: teleucab.esy.es");
    client.println("Cache-Control: no-cache");
    client.println("Postman-Token: aeb24f82-72a9-c643-728b-fc9ebc2acfc7");
    client.println(" ");     
    }
    
  else {
    // you didn't get a connection to the server:
    Serial.println("--> connection failed/n");
  }
}


void ledFadeToBeat(){
    fadeRate -= 15;                         //  set LED fade value
    fadeRate = constrain(fadeRate,0,255);   //  keep LED fade value from going into negative numbers!
    analogWrite(fadePin,fadeRate);          //  fade LED
  }

my php code is:
add_data.php

<?php
    // Connect to MySQL
 $con=mysqli_connect("localhost","*********r","*****","*****");

        // Prepare the SQL statement
        $SQL = "INSERT INTO test (temperature,frequency) VALUES ('".$_GET["temp".$counter]."','".$_GET["bpm".$counter]."')";

        // Execute SQL statement
       mysqli_query($con, $SQL);

mysqli_close($con);

?>

And the monitor serie show my all the variables that i expect and the connect message

That is a screenshot from my monitor serie

Another proof that i use is with postman do a GET request and check in the database and its inserted with no problems

I attachment my code

AllSerialHandling.ino (2.08 KB)

Interrupt.ino (5.61 KB)

PulseSensorAmped_Arduino_1dot4.ino (3.81 KB)

Timer_Interrupt_Notes.ino (7.5 KB)

You send a GET command to the server. The server sends back a reply that you COMPLETELY ignore. If you want to know what the server does not like about your GET request, ignoring the server output is NOT the way to go.

What web server software is running on the server? Can you look at the server log files?

    client.print("&amp;");

Wrong. You want to send an &, NOT the html equivalent of an &:

    client.print("&");