PDA

View Full Version : forumlist while


sabret00the
07-23-2004, 02:54 PM
what am i doing wrong this won't work

$forumlist=$DB_site->query_first("
SELECT *
FROM forum
WHERE threadcount > 0
AND forumid NOT IN (11,16,42,46,47,1,13,38,53,90,92,95)
AND parentid NOT IN (2,10,13,19,70,16,33,24,49,53,79,96)
ORDER BY RAND()
");
// $resultlatest = mysql_query($query,$db);

$counted = 0;
while ($forumlist_array = $DB_site->fetch_array($forumlist))
{
$forumlist_array['title'] = nl2br(stripslashes($forumlist_array['title']));
$forumlist_array['description'] = nl2br(stripslashes($forumlist_array['description']));
$forumlist_array['forumid'] = number_format($forumlist_array['forumid']);
extract($forumlist_array);

eval('$siteindex_forumlistbit .= "' . fetch_template("siteindex_forumlistbit") . '";');
$counted++;

if ( $counted == 5 ) {
break;
}
}the query works perfectly but it all goes wrong in the while

CarCdr
07-23-2004, 03:24 PM
What do you mean "it all goes wrong..."

Perhaps you are getting no results from the query. Is the 'while' running at all? Check that you have some results with:
if ($DB_site->num_rows($forumlist) == 0) {
NO RESULTS CODE
}

ps: I don't think you want to run 'number_format' on a forum ID.

sabret00the
07-23-2004, 03:55 PM
you're right, it's not returrning nothing :(

i don't understand why

sabret00the
07-23-2004, 03:57 PM
fixed it, had to change the query first to a query

Dean C
07-23-2004, 03:58 PM
Oh dear - I hate it when that happens ;)