这是我想要实现的一个非常简化的示例:
USERS
id | name
12 | Phil
ACTIONS
sender | recipient
12 | Alice
$table = query("SELECT id, sender FROM users WHERE recipient = Alice");
foreach ($table as $row) {
$sender = $row['sender'];
echo '$sender has sent a gift to Alice';
}
这将输出:
12 sent a gift to Alice
我怎样才能得到下面的输出呢?
**Phil** sent a gift to Alice
我应该加入这两个表吗?