How can i delete table row from database?

list.js file

delete icon:

td = document.createElement("td");          
          td.setAttribute("style","border: 1px solid black;");          
          cellText = document.createElement('i'); 
          cellText.setAttribute("data-id",data[i].pid);         
          cellText.setAttribute("class","fa-solid fa-trash");
          cellText.setAttribute("onclick", "pDelete(this)");
          td.appendChild(cellText);          
          row.appendChild(td);     

pDelete(elem):

pDelete(elem) {
        let id = elem.getAttribute("data-id");
        fetch(`pdelete/index.php?id=${id}`, {
            method: 'DELETE'
        });
    }

pWorks file:

public static function pDelete($params){
        $params=json_encode($params, true);
        extract(json_encode($params,true));
        $db=new DBConnect();
        $sql="DELETE from products  WHERE pid=:$id";
        $db->sqlExec($sql);
    }

pdelete/index.php file:

<?php

require_once("../app/pWorks.php");

if ($_SERVER["REQUEST_METHOD"] == "DELETE") {
    $id = isset($_GET['id']) ? $_GET['id'] : null;
    if (!empty($id)) {
        pWorks::pDelete($id);
        echo "deleted";
    }else{echo "nope";}

}

my primary key is pid on database. it doesnt delete anything.

my primary key is pid on database. it doesnt delete anything. my primary key is pid on database. it doesnt delete anything. my primary key is pid on database. it doesnt delete anything. my primary key is pid on database. it doesnt delete anything. my primary key is pid on database. it doesnt delete anything. my primary key is pid on database. it doesnt delete anything. my primary key is pid on database. it doesnt delete anything. my primary key is pid on database. it doesnt delete anything. my primary key is pid on database. it doesnt delete anything. my primary key is pid on database. it doesnt delete anything.