我有 2 个表用户和消息:用户包含id
, fullname
, email
,password
消息包含id
, sender
, receiver
,link
我想阅读接收者(用户id
)的所有链接,其中它等于email
,以及echo
发送者和接收者的全名以及链接。
有人请,我对此有点陌生?
$sql = mysql_fetch_assoc("SELECT m.sender,m.receiver, m.link, u.fullname, u.email
FROM `users` AS u
JOIN `messages` AS m ON m.receiver = u.id
WHERE u.email = '$email'");
echo $sql['sender'];