Ok, I figure it out. The problem was about my table, there was a space character before my actual text, this make the condition useless. Here is the correct code maybe someone will find this useful. But be careful this is wide open to SQL Injection.
<?php
require 'config.php';
if(!empty($_SESSION["id"]))
{
$id= $_SESSION["id"];
$result = mysqli_query($conn,"SELECT * FROM tb_user WHERE id= $id");
$row = mysqli_fetch_assoc($result);
}
else
{
header("Location: login.php");
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Profile</title>
<style type="text/css">
input{
border: none;
}
</style>
</head>
<body>
<table cellspacing= 0 cellpadding=10>
<tr>
<td>#</td>
<td>Expeditor</td>
<td>Mesaj</td>
</tr>
<?php
$i=1;
$id2= $_SESSION["id"];
$result= mysqli_query($conn, "SELECT * FROM tb_user WHERE id= $id2");
$row = $result->fetch_assoc();
$userconn = $row['username'];
echo $userconn;
$rows= mysqli_query($conn, "SELECT * FROM mesajeuseri WHERE username='$userconn'")
?>
<?php foreach ($rows as $row): ?>
<tr>
<td><?php echo $i++; ?></td>
<td><?php echo $row["expeditor"] ?></td>
<td><?php echo $row["mesajtext"]; ?></td>
<td>
<a href="">Contact</a>
</td>
</tr>
<?php endforeach; ?>
</table>
</body>
</html>