I have two tables in MySQL - one for feeds and one for the feeds tags.
So to show the feed and its tags I have a while loop inside a while loop.
The problem is the nested one only gets some rows - need all tags (rows).
Please help.
$news_result = mysql_query("SELECT feed_id, feed_title, feed_date, feed_comments, feed_contents FROM news_feed");
$news_num_rows = mysql_num_rows($news_result);
while($news_row = mysql_fetch_array($news_result))
{
$feed_id = $news_row['feed_id'];
$feed_title = $news_row['feed_title'];
$feed_date = $news_row['feed_date'];
echo "<div class='title'>$feed_title</div>";
echo "<div class='sub_title'>Posted on $feed_date";
// Tags
$tag_result = mysql_query("SELECT feed_unique_id, feed_id, feed_tag FROM news_feed_tags WHERE feed_id = $feed_id");
$tag_row = mysql_fetch_array($tag_result);
echo "Tags: ";
while($tag_row = mysql_fetch_array($tag_result))
{
$tag = $tag_row['feed_tag'];
echo "<a href='$tag'>$tag</a>, ";
}
// End tags
}