/** * @return mixed */ public function save() { $productSQL = "'" . $this->name . "'"; DbFunctions::insert("INSERT INTO products (product_name) VALUES (" . $productSQL . ")"); $this->id = DbFunctions::sql("SELECT product_id FROM products\n WHERE product_name = '" . $this->name . "'\n ORDER BY product_id DESC", 1)['product_id']; $descriptionSQL = $this->id . ", '" . $this->description . "', " . $this->price . ", " . $this->quantity . ", NULL"; DbFunctions::insert("INSERT INTO products_description VALUES (" . $descriptionSQL . ")"); }