Created
June 2, 2016 13:25
-
-
Save lornajane/9678e0aff91eb10f4a4b1c95e6655d40 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_STRING); | |
$data = ["username" => filter_input(INPUT_POST, "name", FILTER_SANITIZE_STRING), | |
"comment" => filter_input(INPUT_POST, "comment", FILTER_SANITIZE_STRING), | |
]; | |
$posts->updateOne(["_id" => new MongoDB\BSON\ObjectID($id)], ['$push' => ["comments" => $data]]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment