我认为您应该执行子查询:
<?php
if($sq = $mysql_connection->query('SELECT `follow_by` following, `follow_to` followers, `author_id` id FROM `relations` WHERE `author_id`=(SELECT `author_id` FROM `posts`)')){
if($sq->num_rows){
while($row = $sq->fetch_object()){
// each row now has the following attributes within the loop
// $row->following // $row->followers // $row->id
}
}
$sq->free();
}
$mysql_connection->close();
?>
当然,如果您使用客户机信息进行MySQL查询,您需要准备语句。