Nieuw lid |
|
Onderstaande code toont slechts 1 rij op de pagina, terwijl er eigenlijk 2 rijen in de database zitten. Heeft er iemand een idee?
$query = 'SELECT * FROM news_topic ORDER BY date DESC, time DESC LIMIT 5';
$result = mysql_query($query);
while ($i = mysql_fetch_assoc($result)) {
echo '<tr>
<td><img src="images/news/'.$i['cat'].'.bmp" alt="N" /></td>
<td>'.$i['date'].' - '.$i['time'].'</td>
<td><a href="news.php?topic='.$i['id'].'">'.$i['subject'].'</a></td>
<td>';
//aantal replies
$q = 'SELECT COUNT(*) AS aantal FROM news_reply WHERE topic = "'.$i['id'].'"';
$r = mysql_query($q);
while ($j = mysql_fetch_assoc($r)) {
echo '('.$j['aantal'].' replies)';
}
echo '</td></tr>';
}
$query = 'SELECT * FROM news_topic ORDER BY date DESC, time DESC LIMIT 5'; <td><img src="images/news/'.$i['cat'].'.bmp" alt="N" /></td> <td>'.$i['date'].' - '.$i['time'].'</td> <td><a href="news.php?topic='.$i['id'].'">'.$i['subject'].'</a></td> <td>'; //aantal replies $q = 'SELECT COUNT(*) AS aantal FROM news_reply WHERE topic = "'.$i['id'].'"'; echo '('.$j['aantal'].' replies)'; } }
|