} } //update user details $query = $dbconn->prepare("UPDATE `user-details` SET `Firstname`=:fname, `Surname`=:sname,\r\n\t\t\t`Email`=:email, `PhoneNumber`=:phone, `UniId`=:uni, `CampusId`=:camp WHERE \r\n\t\t\t`UserId`=:userid"); $query->bindParam(":fname", $fname); $query->bindParam(":sname", $sname); $query->bindParam(":email", $email); $query->bindParam(":phone", $phone); $query->bindParam(":uni", $uni); $query->bindParam(":camp", $camp); $query->bindParam(":uni", $uni); $query->bindParam(":userid", $userid); $result = $query->execute(); if ($result) { if ($img_flag == true) { $img = retrieveProfileImg($userid, $dbconn); if (count($img) == 0) { $sql = $dbconn->prepare("INSERT INTO `profile-images`(`UserId`, `Image`, `Type`) VALUES (:id, :img, :type)"); $sql->bindParam(':img', $fp, PDO::PARAM_LOB); $sql->bindParam(':id', $userid); $sql->bindParam(':type', $imgType); $result = $sql->execute(); //Check if its succesful if ($result) { setNotice("Your account has been succesfully updated!", "alert alert-success"); } else { setNotice("Oops! There seems to be a problem. Try again and if the problem persists contact our team."); } } else { $sql = $dbconn->prepare("UPDATE `profile-images` SET `Image`=:img, `Type`=:type WHERE `UserId`=:userid"); $sql->bindParam(':img', $fp, PDO::PARAM_LOB);
<?php include "database/connect.php"; include "functions/general.php"; if (isset($_GET['user'])) { $user = $_GET['user']; $user = retrieveUserByName($user, $dbconn); $img = retrieveProfileImg($user['UserId'], $dbconn); if (count($img) == 0) { $img = retrieveProfileImg(0, $dbconn); } header("Content-type: image/" . $img[0]['Type']); echo $img[0]['Image']; }