-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadd_feature.php
33 lines (23 loc) · 864 Bytes
/
add_feature.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
require_once('config.php');
session_start();
// Processing form data when form is submitted
if($_SERVER["REQUEST_METHOD"] == "POST"){
$insRec = new MongoDB\Driver\BulkWrite;
$id = $_POST['id'];
$key = $_POST['Title'];
$paper = $_POST['index'];
$conf = $_POST['comment'];
$publication = array();
for($i = 0; $i < count($paper); $i++){
$local = array("Index" => $paper[$i], "Comment" => $conf[$i]);
array_push($publication, $local);
}
$insRec->update(['_id'=>new MongoDB\BSON\ObjectID($id)],['$set' => [$key => $publication]]);
$writeConcern = new MongoDB\Driver\WriteConcern(MongoDB\Driver\WriteConcern::MAJORITY, 1000);
$result = $manager->executeBulkWrite('faculty_portal.users', $insRec, $writeConcern);
if($result)
header('Location: '.$_SESSION['url']);
//$result->getModifiedCount();
}
?>