prepare($sql); $stmt->bindParam(':username', $_POST['username'], PDO::PARAM_STR); $stmt->bindParam(':firstname', $_POST['firstName'], PDO::PARAM_STR); $stmt->bindParam(':lastname', $_POST['lastName'], PDO::PARAM_STR); $stmt->bindParam(':phone', $_POST['phone'], PDO::PARAM_STR); $stmt->bindParam(':address', $_POST['address'], PDO::PARAM_STR); $stmt->bindParam(':userid', $_SESSION['userid'], PDO::PARAM_INT); $stmt->execute(); header('location: ./Profile.php'); die(); } $sql = "SELECT users.*, member.* FROM users INNER JOIN member ON member.memberid = users.userid WHERE memberid = :userid"; $stmt = $conn->prepare($sql); $stmt->bindParam(':userid', $_SESSION['userid'], PDO::PARAM_INT); $stmt->execute(); if($stmt->rowCount() == 0) { $sql = "SELECT * FROM users WHERE userid = :userid"; $stmt = $conn->prepare($sql); $stmt->bindParam(':userid', $_SESSION['userid'], PDO::PARAM_INT); $stmt->execute(); $users = $stmt->fetch(PDO::FETCH_ASSOC); $users['address'] = ""; $users['phone'] = ""; $users['firstname'] = ""; $users['lastname'] = ""; } else { $users = $stmt->fetch(PDO::FETCH_ASSOC); } ?>