我的功能看起来像这样
$sql = "SELECT * FROM friends WHERE id1='$id' AND accepted=1 AND notification=1;";
$result = mysqli_query($conn, $sql);
$data = mysqli_fetch_all($result, MYSQLI_ASSOC);
header("Content-Type: application/json");
echo json_encode($data);
我想从另一个表中选择一些东西。我该怎么办?