function setupUser($mysqli, $userId, $image, $graduationYear) { if (doesUserExist($mysqli, $userId)) { if ($sua = setUserAvatar($mysqli, $userId, $image)) { if ($stmt = $mysqli->prepare("UPDATE members SET graduation_year = ?, setup = TRUE WHERE id = ? LIMIT 1")) { $stmt->bind_param("ii", $graduationYear, $userId); $stmt->execute(); return true; } else { return "Faulty MYSQLI Statement #2"; } } else { return $sua; } } else { return "User does not exist #2"; } }
<?php include_once '../functions.php'; include_once '../db_connect.php'; sec_session_start(); if (isset($_POST['user_id'], $_FILES['image'])) { $fileName = $_FILES['image']['tmp_name']; echo setUserAvatar($mysqli, $_POST['user_id'], $fileName); } else { echo "POST/FILES variables not set"; }