-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprocess_updateproject.php
More file actions
36 lines (34 loc) · 1.12 KB
/
process_updateproject.php
File metadata and controls
36 lines (34 loc) · 1.12 KB
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
34
35
36
<?php
/**
* Created by PhpStorm.
* User: louis
* Date: 4/28/17
* Time: 6:45 PM
*/
session_start();
require_once ('include/helpfulFunctions.php');
require_once ('include/dbconfig.php');
require_once('include/header.php');
$pid = $_SESSION['pid'];
$pdo = db_connect();
$stmt = $pdo -> prepare (
"insert into ProjectDetails (pid, updateContent, updateDescription)
values (:pid, :updateContent, :updateDescription)"
);
$img = $_FILES['file'];
$updateContent = file_get_contents($img['tmp_name']);
$updateDescription = $_POST['project-description'];
$stmt -> bindParam(":pid", $pid, PDO::PARAM_STR);
$stmt -> bindParam(":updateContent", $updateContent, PDO::PARAM_LOB);
$stmt -> bindParam(":updateDescription", $updateDescription, PDO::PARAM_STR);
try {
$result = $stmt->execute() or die ("Unable to update. " . $stmt->errorCode());
} catch (Exception $e) {
echo $e -> getMessage();
}
if (isset($result)) {
correctMessage("Update project successfully! Redirecting to the project page...");
echo "<meta http-equiv='refresh' content='2; url=project.php?pid=$pid'>";
}
require_once ('include/footer.html');
?>