I get
Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
when trying to run the following code, both with bindValue and bindParam yet can't seem to see what is wrong.
class Product {
public function productAdd($x) {
$core = Core::getInstance(); // This part works OK
$stmt = $core->dbh->prepare('INSERT INTO Product (Product_Name) VALUES (:product-name)');
$stmt->bindValue(':product-name', $x, PDO::PARAM_STR);
$stmt->execute();
}
}
$product = new Product;
$productadd = $product->productAdd('Blue Sunglasses');
-. Try without that, like:productName