PDA

View Full Version : basic while loop problem (admincp)


sabret00the
03-02-2005, 10:56 AM
this would normally work perfectly, but for some reason it won't i blame the modcp lol

$total = $DB_site->query("
SELECT COUNT(*)
FROM maf_application
");

// $appcount = number_format($DB_site->num_rows($total));

print_form_header();
print_table_header('Applications Awaiting Consideration');

if (!empty($total))
{
$appz=$DB_site->query("
SELECT *
FROM maf_application
LEFT JOIN " . TABLE_PREFIX . "user ON (" . TABLE_PREFIX . "user.userid = maf_application.userid)
");

$havegroups = false;

while ($app=$DB_site->fetch_array($appz))
{
if ($havegroups)
{
print_description_row('<span class="smallfont">&nbsp;</span>', 0, 2, 'thead');
}
else
{
print_label_row('' . stripslashes($app['username']) . '\'s Application', '[<b><a href="maf_rateapp.php?s=' . $session[sessionhash] . '&do=rate&appid=' . $app[appid] . '">rate it</a></b>]');
}
$havegroups = "true";
}
}


what am i doing wrong?

Zero Tolerance
03-02-2005, 11:28 AM
The problem isn't the loop, its your query, change it to this:
$appz=$DB_site->query("
SELECT a.*,u.*
FROM maf_application a
LEFT JOIN " . TABLE_PREFIX . "user u ON (u.userid = a.userid)
");

- Zero Tolerance

sabret00the
03-02-2005, 11:52 AM
neverworked so i got a little confidence and turned out the problem was the conditional :)