0
I’m hoping that when $total comes in and goes from 40 to div="te" and the li class="ta" stay with display:block.
CSS:
.foo {
width: 50px;
height: 50px;
background-color: red;
float: left;
display:block;
}
.hide {
display: none;
}
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Meu Contator</title>
<link href="css/estilo.css" rel="stylesheet">
</head>
<body>
<?php
$servidor = 'localhost';
$banco = 'test';
$usuario = 'root';
$senha = '';
$link = @mysql_connect($servidor, $usuario, $senha);
$db = mysql_select_db($banco,$link);
$idUltimoItem = 0;
if(!$link)
{
echo "erro ao conectar ao banco de dados!";exit();
}
$sql = "SELECT * FROM tabela";
$query = mysql_query($sql);
$total = mysql_num_rows($query);
while($sql = mysql_fetch_array($query)){
}
echo "$total";
?> <br />
<div id="te" class="<?php echo $total >=40 ? 'foo' : 'hide'; ?>"></div>
<ul>
<li class="<?php echo $total >=3 ? 'foo' : 'hide'; ?>;"> <a href="#"><p>INGRESSO</p></a> </li>
</ul>
</body>
</html>
Wouldn’t it be better to leave everything in . css ? And use only the attribute
class=
?– Guilherme Nascimento
yes yes it goes in css the styles and Talz... but I want to know how I do the function
– kaiquemix
It’s just that I found the use of
style="..."
I thought that’s what you wanted I’ll try to work out an answer.– Guilherme Nascimento