/* technique 1 - question mark placeholders, explicit binding */ $sql = "INSERT INTO books (ISBN10, Title, CopyrightYear, ImprintId, ProductionStatusId, TrimSize, Description) VALUES (?,?,?,?, ?,?,?)"; $statement = $pdo->prepare($sql); $statement->bindValue(1, $_POST['isbn']); $statement->bindValue(2, $_POST['title']); $statement->bindValue(3, $_POST['year']); $statement->bindValue(4, $_POST['imprint']); $statement->bindValue(4, $_POST['status']); $statement->bindValue(6, $_POST['size']); $statement->bindValue(7, $_POST['desc']); $statement->execute(); /* technique 2 - named parameters */ $sql = "INSERT INTO books (ISBN10, Title, CopyrightYear, ImprintId, ProductionStatusId, TrimSize, Description) VALUES (:isbn, :title, :year, :imprint, :status, :size, :desc) "; $statement = $pdo->prepare($sql); $statement->bindValue(':isbn', $_POST['isbn']); $statement->bindValue(':title', $_POST['title']); $statement->bindValue(':year', $_POST['year']); $statement->bindValue(':imprint', $_POST['imprint']); $statement->bindValue(':status', $_POST['status']); $statement->bindValue(':size', $_POST['size']); $statement->bindValue(':desc', $_POST['desc']); $statement->execute();