I have a user system in which I send a request (who sends) so that the other user (who receives it) responds.When.I do the sending the button that said "Add" changes to "Request sent" The problem is that when I enter the profile or better said entry with the account of the user to whom I send the request and search through the search engine to the user who sent me the request the button says the same, I mean, "request sent". I do so that the button says "Accept request". The button I printed with an 'echo'. I do not know what else to do. I'm somewhat limited in PHP.
Table people (users)
------- -------- ----------- --------- -------- -------
Id Nombre Apellidos Correo Password Foto
-------- --------- --------- -------- -------- -------
5 Luis Tavarez @ **** .jpg
6 Jose Martinez @ **** .jpg
Relationship / friends table
------------ -------- ----------- --------
Id User_one User_two Activo
---------- --------- --------- --------
1 5 6 0
This is my code:
<?php
include_once('conexion.php');
if ($user != $my_id) {
$mysqli = mysqli_connect("localhost", "root", "", "registros");
$quer = mysqli_query($mysqli,"SELECT * FROM friends WHERE (User_one =
'$my_id' AND User_two = '$user') OR (User_one = '$user' AND User_two =
'$my_id')");
if (mysqli_num_rows($quer) > 0)
{
while ($nada = mysqli_fetch_assoc($quer)) {
if ($nada['Activo'] == 1) {
$mensaje = "<div class='dropdownx'><button type='button'
onclick='myFunction()' class='dropbtnx'><i class='fa fa-thumbs-
o-up' aria-hidden='true'></i>Amigos<i class='fa fa-caret-down'
aria-hidden='true'></i></button><div id='myDropdownx'
class='dropdowncontentx'>
<a href='#'>Dejar de ser amigos.</a>
<a href='#about'>About</a>
</div></div>";
}
elseif ($nada['Activo'] == 0)
{
$mensaje = "<div class='dropdownx'><button type='button'
onclick='myFunction()' class='dropbtnx'>Solicitud enviada<i
class='fa fa-caret-down' aria-hidden='true'></i></button><div
id='myDropdownx' class='dropdowncontentx'>
<a href='#'>Cancelar Solicitud</a>
<a href='#about'>About</a>
</div></div>";
}
}
}
else { // if the relationship don't exist
$mensaje = "<div class='dropdownx'><button type='button'
onclick='guardar(".$user.")' class='dropbtnx'><i class=' fa fa-plus'
aria-hidden='true'></i>Agregar</button></div>";
}
}
?>