A
Alekseev
Гость
выводит тока в первый раз, после выходит ошибка
Код:
Warning: Invalid argument supplied for foreach()
Warning: Invalid argument supplied for foreach()
'USER' => get_username($row['user_id']),
<a href="profile.php?mode=viewprofile&u={activ_user.USER_ID}" title="{activ_user.USER}, Сообщения: {activ_user.POSTS}"><span>{activ_user.AVA}</span></a>
if($bb_cfg['activ_user'])
{
if (!$activ_user = CACHE('bb_cache')->get('activ_user', 300))
{
$activ_user = DB()->fetch_rowset(" SELECT user_id,user_posts,user_avatar,user_avatar_type,user_opt FROM bb_users WHERE user_id NOT IN (' " . EXCLUDED_USERS_CSV . " ') ORDER BY user_posts DESC LIMIT 12 ");
CACHE('bb_cache')->set('activ_user', $activ_user);
}
foreach($activ_user as $row)
{
$template->assign_block_vars('activ_user', array(
'AVA' => get_avatar($row['user_avatar'], $row['user_avatar_type'], !bf($row['user_opt'], 'user_opt', 'allow_avatar'),48, 48),
'POSTS' => $row['user_posts'],
'USER' => get_username($row['user_id']),
'USER_ID' => $row['user_id'],
));
}
}
что настряпали, то и получиликэшируется но запросов куча | MySQL: 0.017 сек (5%) · 18 запр. |
if($bb_cfg['activ_user'])
{
if (!$activ_user = CACHE('bb_cache')->get('activ_user', 300))
{
$activ_user = DB()->fetch_rowset(" SELECT user_id, username, user_posts,user_avatar,user_avatar_type,user_opt FROM bb_users WHERE user_id NOT IN (' " . EXCLUDED_USERS_CSV . " ') ORDER BY user_posts DESC LIMIT 12 ");
CACHE('bb_cache')->set('activ_user', $activ_user);
}
foreach($activ_user as $row)
{
$template->assign_block_vars('activ_user', array(
'AVA' => get_avatar($row['user_avatar'], $row['user_avatar_type'], !bf($row['user_opt'], 'user_opt', 'allow_avatar'),48, 48),
'POSTS' => $row['user_posts'],
'USER' => $row['username'],
'USER_ID' => $row['user_id'],
));
}
}
$activ_user = DB()->fetch_rowset(" SELECT user_id,user_posts,user_avatar,user_avatar_type,user_opt
FROM ". BB_USERS ."
WHERE user_id NOT IN(". EXCLUDED_USERS_CSV .")
ORDER BY user_posts DESC
LIMIT 12 ");
if($bb_cfg['activ_user'])
{
if (!$activ_user = CACHE('bb_cache')->get('activ_user'))
{
$activ_user = DB()->fetch_rowset(" SELECT user_id,user_posts,user_avatar,user_avatar_type,user_opt
FROM ". BB_USERS ."
WHERE user_id NOT IN(". EXCLUDED_USERS_CSV .")
ORDER BY user_posts DESC
LIMIT 12 ");
CACHE('bb_cache')->set('activ_user', $sql, 300);
}
foreach($activ_user as $row)
{
$template->assign_block_vars('activ_user', array(
'AVA' => get_avatar($row['user_avatar'], $row['user_avatar_type'], !bf($row['user_opt'], 'user_opt', 'allow_avatar'),48, 48),
'POSTS' => $row['user_posts'],
'USER' => get_username($row['user_id']),
'USER_ID' => $row['user_id'],
));
}
}
[B]Warning[/B]: Invalid argument supplied for foreach()