PHP Snippet 1:
SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`test`.`scores`, CONSTRAINT `scores_ibfk_2` FOREIGN KEY (`picture_id`) REFERENCES `pictures` (`id`)) in /Applications/MAMP/htdocs/legogram/app/model/model.php:173
PHP Snippet 2:
public function deletepicture($user) {
    $this->open();
    $stmt = $this->pdo->prepare(
            <<<SQL
            DELETE FROM
                scores
            WHERE
                picture_id = :pictureId
            SQL
        );
    $stmt->execute([
            ":pictureId" => $user["id"]
        ]);
    $stmt = $this->pdo->prepare(
            <<<SQL
            DELETE FROM
                pictures
            WHERE
                id = :id
            SQL
        );
    return $stmt->execute([
            ":id" => $user["id"]
        ]);
}
PHP Snippet 3:
DELETE FROM scores WHERE picture_id = :id
DELETE FROM pictures WHERE id = :id