PHP OOP插入数据[关闭]

I'm facing a problem about inserting data into MySQL database.

public function insert($setTable, $setRow, $setValues) {

        $row = join(", ", $setRow);
        $values = join(", ", $setValues);       
        $result = mysqli_query($this->connect, "INSERT INTO $setTable ($row) VALUES ($values)");

        return $result;     
}

$currentLink = "test";
$st = 2;
$ide = 0;

$objMysql->insert("url", array("id_transaction", "id_user", "url"), array("$st", "$ide", "$currentLink"));

This is not working. What's wrong with my code?

You need to use implode() for rows / values also proper quotations. using join doest not implode comma to string. i dont know where you use $this->connect or $objMysql but you've to make sure it is properly defined. so below functions will work properly.

function insert($setTable, $setRow, $setValues) {

        $row = implode(",", $setRow);
        $values = implode('","',$setValues);
        $prepareQuery = 'INSERT INTO '.$setTable.' ('.$row.') VALUES ("'.$values.'")';
        $result = mysqli_query($this->connect, $prepareQuery);
        return $result;
}