Ir para conteúdo
Fórum Script Brasil
  • 0

Obter dados somente true


cs007

Pergunta

Olá, tenho um site em php onde ele mostra os valores true e false que se encontra na database, eu gostaria que ele só mostrasse os true.

Aqui segue o código da minha home.

<?php include("public/js/keyboard.php");?>
<?php include ("cont.php"); ?>
<link rel="stylesheet" type="text/css" href="<?php echo WEBSITE; ?>/public/css/login.css">
<script language="JavaScript">
var auto_refresh = setInterval(
function ()
{
$('#featured').load('home.php').fadeIn("7000");
}, 10000);
$(document).ready(function() {$('#featured').fadeIn(7000)});
</script>
<?php
require("config.php");
$ide = new IDE;
try { $ide->loadInjections("home"); }catch(Exception $e) { error($e->getMessage());}
// echo "<center><a href='http://www.hostgamers.com'><embed src='/public/images/anuncio/hostgamers.swf' height='100' width='500' href='http://www.hostgamers.com'></a></center>";
echo "<center><a href='http://otlist.info'><img src='/public/images/anuncio/500x50.png'></a></center>";

foreach($news['news'] as $value) {
    echo "<div class='news'>";
    echo "<div class='newsTitle'>".$value['title']."</div>";
    echo "<div class='newsBody'>".$value['body']."</div>";
    echo "<div class='newsFooter'>Posted on: ".UNIX_TimeStamp($value['time'])." </div>";
    echo "<div class='viewComments'><a href='".WEBSITE."/index.php/home/view/".$value['id']."'>View comments</a></div>";
    echo "</div>";
}

    //echo "<div class='readArchive'><a href='".WEBSITE."/index.php/home/archive'>Go to archive posts</a></div></br>";
    echo "<table width='80%'>";
echo "<td width='263'><image src='".WEBSITE."/public/images/features.jpg' width='263'/></td><td width='263'><image src='".WEBSITE."/public/images/statistics.jpg' width='263'/></td><td width='263'><image src='".WEBSITE."/public/images/adiver.jpg'width='263'/></td>";

    echo "<tr><td class='message' width='25%'><center><div id=\"featured\" style=\"display: none;\">";
foreach($featured as $promo) {
$promoUptime = $promo['uptime'];
$h = floor($promoUptime / 3600);
$m = floor(($promoUptime - $h*3600) / 60);
$featUptime = ''.$h.'h '.$m.'m';
echo "
<h2>
    <b>
        <div style='float: left; width: 225px; text-align: center; border-bottom: 1px dotted silver;'>
    Featured: <font color='blue'>".$promo['name']."
<div>
    <image src='".WEBSITE."/public/images/flags/".$promo['location'].".gif'/>
<a href='http://".$promo['ip']."'>".$promo['ip']."</a>
    </font>
    </b> <br>
Port: ".$promo['port']."
<div>Uptime: ".$featUptime."</div>
<div>Type: ".$promo['pvp_type']."
</div>
<div>Online: <font color='green'>".$promo['players'].'/'.$promo['peak']."</font> players!</div>
</h2>
</center>
</div>
</div>
</td>";
}

    echo "<td class='message' width='25%'><center>
<h2>Latest update of servers was: <font color='green'>".ago(filemtime(FCPATH.'/cache/status.xml'))."</font><br> In our database is currently: <font color='green'>".$total_servers."</font> servers at all!<br>";
foreach($stat as $stats) {
echo "On the <b><font color='green'>".$stats['online']."</font></b> online servers is now <font color='green'>".$stats['all']."</font> players!</h2></center></td>";
}

            
echo "<td class='message' width='25%'><center>";
            if(empty($pictures))
                echo "<img src='/public/images/anuncio/200x80.png'>";
            else {
                foreach($pictures as $picture) {
                        echo "<h2><div style='float: left; width: 200px; text-align: center; border-bottom: 1px dotted silver; margin-bottom: 10px;'>Image:";
                            echo "<div style=''>";
                            echo "<a href='".WEBSITE."/index.php/picture/view/".$picture['id']."'><img style='border: 1px groove silver; padding: 1px;' src='".WEBSITE."/public/gallery/".$picture['youtube'].".png' width='120' height='90'/></a>";
                            echo "</div>";
                            echo "<div margin-left: 5px;'>";
                            echo "<b><a href='".WEBSITE."/index.php/picture/view/".$picture['id']."'>".$picture['title']."</a><br/>";
                            echo "Views: ".$picture['views']."<br/>";
                            echo "Added: ".ago($picture['time'])."<br/></b>";
                            echo "</div></div>";
                        echo "</center></td></tr></h2>";
                    }
            }
    echo "</table>";
echo "<div width='100%' class='bar'><h1>Server List</h1></div>";
if(count($servers) > 0) {
    
    echo "<b>Pages: <a href='".WEBSITE."/index.php/server/online'/>[1]</a> <a href='".WEBSITE."/index.php/server/online/30'/>[2]</a> <a href='".WEBSITE."/index.php/server/online/60'/>[3]</a> <a href='".WEBSITE."/index.php/server/online/90'/>[4]</a></b>";
    echo "<table width='100%' style='background: url(".WEBSITE."/public/images/list_top760.jpg) no-repeat;'>";
    echo "<tr><td><center><b>.</b></center><br></td> <td><center><b>Adress</b></center></td> <td><center><b>Name</b></center></td> <td><center><b>Players/Max</b></center></td> <td><center><b>Uptime</b></center></td> <td><center><b>Client</b></center></td> <td><center><b>Exp</b></center></td> <td><center><b>PvP</b></center></td> <td><center><b>Online</b></center></td></tr>";
    foreach($servers as $id=>$row) {
$rowUptime = $row['uptime'];
$h = floor($rowUptime / 3600);
$m = floor(($rowUptime - $h*3600) / 60);
$serverUptime = ''.$h.'h '.$m.'m';
            $promoted = $row['promotion'];
            if($promoted == 1) { $bgcolor = "#ffde00"; } else { $bgcolor = "#a6d2f7"; } $promoted++;
            if ($row['client_version']) { $version = $row['client_version']; } else { $version = "none"; };
        echo "<tr bgcolor='".$bgcolor."'><td class='serv_list'><center><image src='".WEBSITE."/public/images/flags/".$row['location'].".gif'/></center></td> <td class='serv_list'><center><b>".$row['ip']."</b></center></td> <td class='serv_list'><center>".$row['name']."</center></td> <td class='serv_list'><center>".$row['players'].'/'.$row['peak']."</center></td> <td class='serv_list'><center>".$serverUptime."</center></td> <td class='serv_list'><center>".$version."</center></td> <td class='serv_list'><center>x".$row['exp']."</center></td> <td class='serv_list'><center>".$row['pvp_type']."</center></td> <td class='serv_list'><center><image src='".WEBSITE."/public/images/".$row['online'].".gif'/></center></td></tr>";
    }
    echo "</table>";
    
}
else
    alert("There is no servers online!");
?>

Obrigado a todos.

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

  • 0

<script type='text/javascript'>window.mod_pagespeed_start = Number(new Date());</script>

Boa noite,

amigo você não postou o codigo onde faz a query no banco de dados, não teria como fazer por la?

Desculpe amigo, segue aí.

$o = "ORDER BY `players` DESC";
        return @$this->db->query("SELECT `name`, `ip`, `port`, `players`, `peak`, `exp`, `location`, `client_version`, `pvp_type`, `online`, `uptime`, `promotion` FROM `servers` $o LIMIT ".$page.", ".$config['serversLimit']."")->result_array();
        $ret['amount'] = $sql->num_rows;
        $ret['servers'] = $sql->result_array();
        return $ret;

Editado por cs007
Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152k
    • Posts
      651,8k
×
×
  • Criar Novo...