I ask your help on a subject that I do not really master.
I have two tables: tb_user (NIC_Handle, Pseudo) tb_user_messages_recap (Auteur, Intervenant)
I have to retrieve the NIC_Handle of each 'Pseudo' that corresponds to either 'Auteur' or 'Intervenant'
Can you help me please ?
<?php try{
$MyPDO=$pdo->query("
SELECT
tb_user_messages_recap.Auteur,
tb_user_messages_recap.Intervenant,
tb_user_messages_recap.Numero,
tb_user_messages_recap.Sujet,
tb_user_messages_recap.Creation,
tb_user_messages_recap.Edition,
tb_user_messages_recap.Etat,
tb_user.NIC_Handle,
tb_user.Pseudo
FROM tb_user_messages_recap
LEFT JOIN tb_user
ON tb_user_messages_recap.Auteur = tb_user.Pseudo
WHERE tb_user_messages_recap.Auteur='".$_SESSION_PSEUDO."' OR
tb_user_messages_recap.Intervenant='".$_SESSION_PSEUDO."'
ORDER BY Edition DESC
");
while($data=$MyPDO->fetch(PDO::FETCH_ASSOC))
{
?>
<?php echo $data["NIC_Handle"]." - ".$data["Auteur"]; ?>
<?php echo $data["NIC_Handle"]." - ".$data["Intervenant"]; ?>
<?php echo $data["NIC_Handle"]." - ".$data["Intervenant"]; ?>
<?php }}catch(PDOException $e){echo "<div class='alert alert-danger'>".$e->getMessage()."</div>";} ?>
Thank you for your help,
Cordialy