I am trying to add a create function to a school project someone in my group made a function for creating and I am trying to use it but it just doesn’t insert into the database this is what he has
//insert functions
//...
//function for products
public function insertRecordToProducts ($product_type, $name, $Description, $img_url, $price) {
$qeury = "INSERT INTO products (product_type, name, Description, img_url, price)
VALUES ('$product_type', '$name', '$Description', '$img_url', '$price')";
$this->dbh()->query($qeury);
}
and this is what I have
if (isset($_POST['create']))
{
$p_id = $_POST['product_id'];
$db->insertRecordToProducts('product_type','name','Description','img_url','url');
}
if anyone could tell me what I did wrong that would be amazing tysm! Just need to call his function