javascript – Execute PHP function from within HTML script

I’m trying to execute a specific PHP command every time my index.html file is run. Specifically, I want to execute the following SQL command from getdata.php which deletes a row from my SQL data table:

$sql = "DELETE FROM studycondition ORDER BY id ASC LIMIT 1";

Thus, the idea is that every time index.html is run then a row from the SQL table is deleted. Any ideas as to how I can execute the delete SQL function from my HTML file?
See below for the full code.

getdata.php


<?php
include('database_config2.php');

$data_array = json_decode(file_get_contents('php://input'), true);


// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}


$sql = "SELECT cond FROM studycondition";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
  // output data of each row
  if($row = $result->fetch_assoc()) {
    //echo json_encode("id: " . $row("cond"). "<br>");
    echo json_encode($row("cond"));
  }
} else {
  echo "0 results";
}

$sql = "DELETE FROM studycondition ORDER BY id ASC LIMIT 1"; //this is what I want to transfer to my HTML file 
 

$conn->close();
?>


index.html

<script>

    function reqListener () {
      console.log(this.responseText);
    }

    var oReq = new XMLHttpRequest(); // New request object
    oReq.onload = function() {
        const js = document.createElement("script");
        var noQuotes = this.responseText.split('"').join('');
        js.src = noQuotes;
        document.head.appendChild(js);

    };


    oReq.open("get", "index.php", true);
    oReq.send();

//line to execute delete SQL data command ???



</script>
```