$order->user_id = $user->id;
$_SESSION['username'] = $username;
$_SESSION['success'] = "You are now logged in";
$_SESSION['user'] = $results->mysqli_fetch_assoc();
$query = "INSERT INTO comenzi (tip, litri, adresa)
VALUES('$tip', '$litri', '$adresa')";
mysqli_query($db, $query);
$query = "INSERT INTO comenzi (tip, litri, adresa, user_id)
VALUES($tip, $litri, $adresa, $_SESSION['user']['id'])";
mysqli_query($db, $query);
$_SESSION['user']
и посмотрите, что она содержитecho '<pre>'.print_r($_SESSION['user'], 1).'</pre>';