I am implementing a system of friendship requests in PHP and MySql. And of course it works for me, but it only shows me only one result, which should show all the results I find.
For example, Juan has received 3 requests. There is a text saying that he has received 3 requests. That's fine. But when it comes to showing the photos, it just shows me one. And I'd like all the photos of the applicants to come out. The code works, it has no errors. It only shows a single data.
and this is the php code:
<?php
include('verific_sesion.php');
// login to the database
$query = mysqli_query($conn,"SELECT * FROM friends WHERE (User_two =
'$my_id' AND Activo = '0')");
$row = mysqli_num_rows($query);
if ($row > 0)
{ // there are new requests
/*Mensaje que da como salida si existen solicitues nuevas*/
$mensajito = "<a href='#'>You have ".$row." new friend
requests</a>";
while ($row = mysqli_fetch_array($query))
{
$yo = $row['User_two'];
if ($yo == $my_id)
{
$solicitante = $row['User_one'];
$who = mysqli_query($conn,"SELECT * FROM personas
WHERE Id = '$solicitante'")or
die(mysqli_error());
while ( $delsolicitante = mysqli_fetch_array($who)) {
$requests = "<a href='#'><img width='100px' height='100' src=" .$delsolicitante['Fotos']."> </img></a></br>
<button class='boton_aceptar'>Aceptar</button><button class='boton_aceptar'>Eliminar</button></br>";
}
}
elseif ($row == 0)
{
$requests = "";
}
}
}
else
{
$requests = "No new requests.";
/*Mensaje que da como salida si no existen solicitues
nuevas*/
$mensajito = "<a href='#'>You have ".$row." new friend
requests</a>";
}
?>