I have some code:
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin']=true ){
$sql = "SELECT * FROM `databale`";
$result = mysqli_query($conn,$sql);
while ($row = mysqli_fetch_assoc($result)){
$id = $row['id'];
$sql2 = "SELECT coin FROM `datatable` WHERE id='$id'";
$result2 = mysqli_query($conn,$sql2);
$row2 = mysqli_fetch_assoc($result2);
echo '
<form class="d-flex ">
<p class="my-0 mx-5 text-light mt-2"><img src="img/1.png" width="30px">
'.$row2 ['coin'].'
</p>
<button class="btn btn-outline-light" type="submit"><a class="text-decoration-none text-light" href="logout.php">LogOut</a></button>
</form>
';
}
}
I want to fetch only one value from the database according to email, but it fetches all values from the database. How can I fix this?
