Não consigo exibir os Dados do Meu Banco de Dados
Pessoal onde esta o erro na minha página ? fiz a tabela para exibir os dados do meu banco MYSQLi , mais quando atualizo ela não exibe,
pagina abaixo.
<!doctype html>
<html>
<head>
<title>Manipulando tabelas com jQuery</title>
<meta charset="utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script src="jquery.tablesorter.min.js"></script>
<script src="jquery.tablesorter.pager.js"></script>
<link rel="stylesheet" href="custom.css" media="screen" />
<?php
$parametro = filter_input(INPUT_GET, "parametro");
$mysqllink = @mysql_connect("localhost","root","");
mysql_select_db("agenda_telefonica");
if($parametro){
$dados = mysql_query("select * from contato where setor like '$parametro%' order by setor");
} else {
$dados = mysql_query("select * from contato order by setor");
}
$linha = mysql_fetch_assoc($dados);
$total = mysql_num_rows($dados);
?>
</head>
<body>
<center>
<h1>Tabelas & jQuery</h1>
<form method="post" action="exemplo.html" id="frm-filtro">
<p>
<label for="pesquisar">Pesquisar</label>
<input type="text" id="pesquisar" name="pesquisar" size="30" />
</p>
</form>
<table cellspacing="0" summary="Tabela de dados fictícios">
<thead>
<tr>
<th><input type="checkbox" value="1" id="marcar-todos" name="marcar-todos" /></th>
<th>ID</th>
<th>Nome</th>
<th>Data de nascimento</th>
<th>Cidade</th>
</tr>
</thead>
<tbody>
<?php
if($total){ do{
?>
<tr>
<td style="visibility: hidden;"><?php echo $linha['id'] ?><center></td>
<td><?php echo $linha['setor'] ?></td>
<td><?php echo $linha['nome'] ?></td>
<td align="center"><?php echo $linha['telefone'] ?></td>
</tr>
<?php
} while($linha = mysql_fetch_assoc($dados));
mysql_free_result($dados);}
mysql_close($mysqllink);
?>
</tbody>
</table>
<script>
$(function(){
$('table > tbody > tr:odd').addClass('odd');
$('table > tbody > tr').hover(function(){
$(this).toggleClass('hover');
});
$('#marcar-todos').click(function(){
$('table > tbody > tr > td > :checkbox')
.attr('checked', $(this).is(':checked'))
.trigger('change');
});
$('table > tbody > tr > td > :checkbox').bind('click change', function(){
var tr = $(this).parent().parent();
if($(this).is(':checked')) $(tr).addClass('selected');
else $(tr).removeClass('selected');
});
$('form').submit(function(e){ e.preventDefault(); });
$('#pesquisar').keydown(function(){
var encontrou = false;
var termo = $(this).val().toLowerCase();
$('table > tbody > tr').each(function(){
$(this).find('td').each(function(){
if($(this).text().toLowerCase().indexOf(termo) > -1) encontrou = true;
});
if(!encontrou) $(this).hide();
else $(this).show();
encontrou = false;
});
});
$("table")
.tablesorter({
dateFormat: 'uk',
headers: {
0: {
sorter: false
},
5: {
sorter: false
}
}
})
.tablesorterPager({container: $("#pager")})
.bind('sortEnd', function(){
$('table > tbody > tr').removeClass('odd');
$('table > tbody > tr:odd').addClass('odd');
});
});
</script>
</body>
</html>Discussão (1)
Carregando comentários...