我有代码:
$somevar=mysql_query("SELECT * FROM feed");
while ($fetched=mysql_fetch_array($somevar)) {
$nextvar=mysql_query("SELECT FROM comments WHERE feed_id='".$fetched['id']."'");
while ($anotherfetch=mysql_fetch_array($nextvar)) {
echo $anotherfetch['comment'];
}
echo $fetched['person'].$fetched['text'];
}
表结构:
feed
id | person | text
comments
id | feed_id | person | comment
优化它的最佳解决方案是什么,有可能吗?我知道在一段时间内犯下一个大错误,但看起来没有其他办法。