Ir para conteúdo
Fórum Script Brasil

tony.tecpc

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Tudo que tony.tecpc postou

  1. Olá pessoal sou iniciante na linguagem php e estou tentando criar uma consulta só que não estou conseguido trazer todos os registros do mysql, preciso se ajuda por favor! Abaixo segue descrição do problema. <?php include "conexao.php"; // Inclui o arquivo de configuraçao do Banco de Dados. $sql = "SELECT id, descricao, ativo, situacao FROM viagens WHERE ativo='sim' AND situacao='aberto' ORDER BY id DESC"; $resultado = mysql_query($sql) or die (mysql_error()); while ($linha=mysql_fetch_array($resultado)) { if ($resultado) { // Cria uma tabela com os resultados. print("<div style=\"width:700px; margin:auto\">"); while ($linha = mysql_fetch_array($resultado)) { print(" <div style= 'width:330px; height:auto; margin:auto; float:left'> <table> <tr> <td style='text-align:center'><a href='rot-exibir.php?id=$linha[id]'>$linha[descricao]</a></td> </tr> </table> </div> "); } print("</div>"); } } ?> Meu bano de dados está d seguinte forma! CREATE TABLE `viagens` ( `id` int(6) unsigned NOT NULL auto_increment, `titulo` text NOT NULL, `descricao` text NOT NULL, `conteudo` text NOT NULL, `ativo` text NOT NULL, `situacao` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ; O que posso fazer?
×
×
  • Criar Novo...