I have a function that searches me in my database work with mysql
function listUser($conexion){
$consulta = (mysqli_query($conexion, "SELECT *, p.nombre as personaNombre, p.id as idPersona, d.nombre as nombreDepartamento, u.id as idUsuario, u.nombre as nombreUsuario
FROM persona as p
JOIN usuario as u
on p.id = u.id_persona
JOIN departamento as d
on u.id_departamento = d.id
ORDER BY p.nombre ASC")) or die("Error listando Usuarios: ".mysqli_error($conexion));
return $consulta;
}
She is returning all the values made with the union of all the tables but I need to exclude the p.id = u.id_person of the user
here I display the list of names on the list
<?php if(!isset($_POST['usuario'])): ?>
<div class="input-field col s6">
<select name="destinatario" id="destinatario">
<option value="0" selected>Seleccione</option>
<?php while($resultado = $consulta2->fetch_array(MYSQLI_ASSOC)): ?>
<option value="<?=$resultado['idUsuario']?>">
<?php echo $resultado['personaNombre'] ?>
<?php echo $resultado['apellido'] ?>
<?php if ($resultado['id_cede'] = 11)
$resultado['id_cede'] = "Sistemas";
echo $resultado['id_cede'] ?>
</option>
<?php endwhile; ?>
</select>
<label for="destinatario">Destinatario</label>
</div>
<?php endif; ?>
and here I show the name of my current user
<div class="col s6">
<strong><?=$resultado['personaNombre']?> <?=$resultado['apellido']?></strong>
</div>