Okay so here is the code that I am using
function AddProducts($aTitle, $aDescription, $aPrice, $aQty, $aPhoto)
{
try {
$stmt = $this->pdo->prepare("INSERT INTO products(title, price, description, qty, photo) VALUES(:title, :price, :description, :qty, :photo)");
if(!$stmt){
$err = $this->pdo->errorInfo();
throw new RuntimeException('PRODUCT INSERT FAILED: '.$err[2]);
}
$stmt->bindValue(':title', $this->title, PDO::PARAM_STR);
$stmt->bindValue(':description', $this->description, PDO::PARAM_STR);
$stmt->bindValue(':price', $this->price, PDO::PARAM_INT);
$stmt->bindValue(':qty', $this->qty, PDO::PARAM_INT);
$stmt->bindValue(':photo', $this->photo, PDO::PARAM_STR);
$stmt->execute();
}catch (PDOException $e) {
echo $e->getMessage();
}
}
$addProducts = $database->AddProducts('Ford Mustang', 'This is a Descriptiom', 299.99, 1, 'images/includes/5.jpg');
The database class and database call function work. Also if you spot anything retarded please point it out, I am trying to learn.