I have code:
$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'];
}
Tables structures:
feed
id | person | text
comments
id | feed_id | person | comment
What's the best solution to optimize it and is it possible at all? I know it's a big mistake to make while in while but it looks like there is no other way..