Andi: php mysql count

Beitrag lesen

Hallo,

also das ist ein richtiger Wurschtelcode. Ich würde das so machen:

$qry = "SELECT  bid, autor, content,thema, stamp  FROM blog_index";
if (($res = mysql_query($qry)) && mysql_num_rows($res))
{
  while ($row = mysql_fetch_object($res))
  {
    $bid = $row->bid;
    $autor = $row->autor;
    $thema = $row->thema;
    $content = $row->content;
    $datum = date("d.M.Y",$row->stamp);
    $uhrzeit = date("H:i",$row->stamp);
    echo"<h1>$thema&nbsp<span>$autor&nbsp | &nbsp $datum &nbsp $uhrzeit</span></h1>";
    echo nl2br ("<p>$content</p>");
    echo"<p><a href="content_comment.php?bid=$bid">Kommentar</a></p>";
    $qry = "SELECT COUNT(bid) FROM blog_comment WHERE bid = '$bid'";
    if (($resC = mysql_query($qry)) && mysql_num_rows($resC) && ($rowC = mysql_fetch_object($resC)))
      echo $row;
  }  // end while
}  // end if