JohnCMS | Не виводило
like (0)
Как сделать чтоби не виводило строку фанати или анти фан если пользователя нмгде нет
Как сделать чтоби не виводило строку фанати или анти фан если пользователя нмгде нет
///Фани////
$req = mysql_query("SELECT `fanclub_vote`.`id`as `vid`, `fanclub`.`id` FROM `fanclub_vote` LEFT JOIN `fanclub` ON `fanclub_vote`.`cid`=`fanclub`.`id` WHERE `fanclub_vote`.`user_id`='" . $user['id'] . "' AND `fanclub_vote`.`count`='1' LIMIT 0,5 ");
echo '<div class="bmenu"><b>Фанат</b></div>';
echo '<div class="menu">';
while ($res = mysql_fetch_array($req)) {
echo '<a href="../fanclub/titul_club.php?id=' . $res['id'] . '"><img src="' . $home . '/fanclub/img/' . $res['id'] . '_small.png" width="25" height="25" align="middle" alt="" border="0"/></a> ';
++$i;
}
echo '</div>';
$req = mysql_query("SELECT `fanclub_vote`.`id`as `vid`, `fanclub`.`id` FROM `fanclub_vote` LEFT JOIN `fanclub` ON `fanclub_vote`.`cid`=`fanclub`.`id` WHERE `fanclub_vote`.`user_id`='" . $user['id'] . "' AND `fanclub_vote`.`count`='0' LIMIT 0,5 ");
echo '<div class="bmenu"><b>Анти-фан</b></div>';
echo '<div class="menu">';
while ($res = mysql_fetch_array($req)) {
echo '<a href="../fanclub/titul_club.php?id=' . $res['id'] . '"><img src="' . $home . '/fanclub/img/' . $res['id'] . '_small.png" width="25" height="25" align="middle" alt="" border="0"/></a> ';
++$i;
}
echo '</div>';
///Фани////
if (isset($user['id'])) {
$req = mysql_query("SELECT `fanclub_vote`.`id`as `vid`, `fanclub`.`id` FROM `fanclub_vote` LEFT JOIN `fanclub` ON `fanclub_vote`.`cid`=`fanclub`.`id` WHERE `fanclub_vote`.`user_id`='" . $user['id'] . "' AND `fanclub_vote`.`count`='1' LIMIT 0,5 ");
echo '<div class="bmenu"><b>Фанат</b></div>';
echo '<div class="menu">';
while ($res = mysql_fetch_array($req)) {
echo '<a href="../fanclub/titul_club.php?id=' . $res['id'] . '"><img src="' . $home . '/fanclub/img/' . $res['id'] . '_small.png" width="25" height="25" align="middle" alt="" border="0"/></a> ';
++$i;
}
echo '</div>';
$req = mysql_query("SELECT `fanclub_vote`.`id`as `vid`, `fanclub`.`id` FROM `fanclub_vote` LEFT JOIN `fanclub` ON `fanclub_vote`.`cid`=`fanclub`.`id` WHERE `fanclub_vote`.`user_id`='" . $user['id'] . "' AND `fanclub_vote`.`count`='0' LIMIT 0,5 ");
echo '<div class="bmenu"><b>Анти-фан</b></div>';
echo '<div class="menu">';
while ($res = mysql_fetch_array($req)) {
echo '<a href="../fanclub/titul_club.php?id=' . $res['id'] . '"><img src="' . $home . '/fanclub/img/' . $res['id'] . '_small.png" width="25" height="25" align="middle" alt="" border="0"/></a> ';
++$i;
}
echo '</div>';
}
if (isset($user['id'])) {
$req = mysql_query("SELECT `fanclub_vote`.`id`as `vid`, `fanclub`.`id` FROM `fanclub_vote` LEFT JOIN `fanclub` ON `fanclub_vote`.`cid`=`fanclub`.`id` WHERE `fanclub_vote`.`user_id`='" . $user['id'] . "' AND `fanclub_vote`.`count`='1' LIMIT 0,5 ");
echo '<div class="bmenu"><b>Фанат</b></div>';
echo '<div class="menu">';
while ($res = mysql_fetch_array($req)) {
echo '<a href="../fanclub/titul_club.php?id=' . $res['id'] . '"><img src="' . $home . '/fanclub/img/' . $res['id'] . '_small.png" width="25" height="25" align="middle" alt="" border="0"/></a> ';
++$i;
}
echo '</div>';
$req = mysql_query("SELECT `fanclub_vote`.`id`as `vid`, `fanclub`.`id` FROM `fanclub_vote` LEFT JOIN `fanclub` ON `fanclub_vote`.`cid`=`fanclub`.`id` WHERE `fanclub_vote`.`user_id`='" . $user['id'] . "' AND `fanclub_vote`.`count`='0' LIMIT 0,5 ");
echo '<div class="bmenu"><b>Анти-фан</b></div>';
echo '<div class="menu">';
while ($res = mysql_fetch_array($req)) {
echo '<a href="../fanclub/titul_club.php?id=' . $res['id'] . '"><img src="' . $home . '/fanclub/img/' . $res['id'] . '_small.png" width="25" height="25" align="middle" alt="" border="0"/></a> ';
++$i;
}
echo '</div>';
}