Jump to content


Displaying Only One Result From MySQL DB


1 reply to this topic

#1 Debian

    Young Padawan

  • Members
  • Pip
  • 14 posts

Posted 18 May 2005 - 07:23 PM

Take a look at my code people:

http://www.theseattl...es/gallery.phps

For some reason it's only displaying one post there.

Any ideas? I've got it limited to thirty starting at record zero.

#2 fiv3isaliv3

    Young Padawan

  • Members
  • Pip
  • 258 posts
  • Gender:Male

Posted 18 May 2005 - 10:18 PM

<?
$query = mysql_query("SELECT * FROM news WHERE cat='3' ORDER BY time DESC LIMIT 0,30") or die("Error @ 1 ".mysql_error());
while ($list = mysql_fetch_object($query)){       

$query_count = mysql_query("SELECT * FROM comments WHERE id='$list->id'") or die("Error @ 2 ".mysql_error());
$count_rows = mysql_num_rows($query_count);
echo "
<div><a href=\"$list->content\"><img src=\"$list->content\" width=\"30%\" border=\"0\"></a></div>
        <div>Added on $list->time - Comments (<a href=\"?c=comments&pid=$id\">$count_rows</a>)</div><br>
        <div align=\"center\"><img src=\"css/images/divider.gif\" class=\"divider\"></div><br>
    ";
}
?>

that should work.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users