I've defined a system in which there is a profile settings defined for logged-in users, in this page which is called "profileset.php", I defined a set of query to fetch the required data, however I end up having an error I don't know why. The first segment of code belongs to my login.php as you can see below :
<?php
session_start();
if($_POST) {
$q = "SELECT * FROM users WHERE email = '$_POST[email]' AND password = SHA1('$_POST[password]')";
$r = mysqli_query($dbc, $q);
if(mysqli_num_rows($r) == 1) {
while($list = mysqli_fetch_assoc($r)) {
$_SESSION['user_id'] = $list['id'];
}
$_SESSION['username'] = $_POST['email'];
header('Location: index.php');
}
}
?>
The second segment of code is in profile setting page, where users are allowed to see their basic profile info's first, so here it is :
<?php
session_start();
$query = mysqli_query("SELECT * FROM users WHERE id = '".$_SESSION['user_id'] ."' ")or die(mysql_error());
$arr = mysqli_fetch_array($query);
?>
and after the query, there's a form in which I call it, for example for the first name, like this :
<label for="first">First Name</label>
<input class="form-control" type="text" name="first" id="first" value="<?php echo $arr['first']; ?>" placeholder="First Name" autocomplete="off">
To my logic, everything is in place, but somehow it ends up with a blank page, any help is appreciated.