manoaj 12 Denunciar post Postado Setembro 7, 2012 pessoal tentei varias coisas mas nao to conseguindo exibir o conteudo da minha tabela na home do meu site minha tabela é esta alguem pode me da uma força com isso... -- phpMyAdmin SQL Dump -- version 3.5.1 -- http://www.phpmyadmin.net -- -- Servidor: localhost -- Tempo de Geração: -- Versão do Servidor: 5.5.24-log -- Versão do PHP: 5.3.13 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Banco de Dados: `teste` -- -- -------------------------------------------------------- -- -- Estrutura da tabela `home` -- CREATE TABLE IF NOT EXISTS `home` ( `id` int(15) NOT NULL AUTO_INCREMENT, `post_home` varchar(255) NOT NULL, `autor_home` varchar(255) NOT NULL, `data` datetime NOT NULL, `titulo_home` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ; -- -- Extraindo dados da tabela `home` -- Compartilhar este post Link para o post Compartilhar em outros sites
Gabriel Jacinto 74 Denunciar post Postado Setembro 7, 2012 Use o mysql_fetch_array(). Exemplo: $sql = mysql_query("SELECT * FROM `home`"); /* Seleciona os dados da tabela */ while($info = mysql_fetch_array($sql)){ /* Agora, dentro desse while, iremos exibir os dados */ /* var Com os id's */ $id = $info['id']; /* var Com o titulo_home */ $titulo_home = $info['titulo_home']; /* E assim por diante */ /* Agora exibindo um link com o id e o titlo */ echo 'ID:'.$id.'<br>'; echo 'Título:'.$titulo_home; } Compartilhar este post Link para o post Compartilhar em outros sites
manoaj 12 Denunciar post Postado Setembro 8, 2012 da erro sempre que uso esse sistema com fetch arning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\home.php on line 64 <body> <div id="topo"> <table id="topota" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="388" align="center"> <div id="wrapper"> <div class="slider-wrapper theme-default"> <div id="slider" class="nivoSlider"> <img src="fotos/slide.png" data-thumb="images/toystory.jpg" alt="" /> <img src="fotos/slide1.png" data-thumb="images/up.jpg" alt="" title="" /> <img src="fotos/slide2.png" data-thumb="images/walle.jpg" alt="" data-transition="slideInLeft" /> <img src="fotos/slide3.png" data-thumb="images/nemo.jpg" alt="" title="" /> <img src="fotos/slide4.png" data-thumb="images/nemo.jpg" alt="" title="" /> <img src="fotos/slide5.png" data-thumb="images/nemo.jpg" alt="" title="" /> </div> <div id="htmlcaption" class="nivo-html-caption"> <strong>This</strong> is an example of a <em>HTML</em> caption with <a href="#">a link</a>. </div> </div> </div> </td> </tr> <tr> <td align="center"> <div id="top"><ul> <li class="selected" ><a href="home.php">Airton Junior</a></li> <li ><a href="agenda.php">Agenda</a></li> <li ><a href="artigos.php">Artigos</a></li> <li ><a href="gale.php">Galeria</a></li> <!--<li ><a href="planos.php">Planos</a></li>--> <li ><a href="mvideos.php">Videos e Musicas</a></li> <li ><a href="contato.php">Contato</a></li> </ul></div> </td> </tr> </table> </div><!--fim topo--> <div id="conteudo"> <?php $sql = mysql_query("SELECT * FROM `home`"); /* Seleciona os dados da tabela */ while($info = mysql_fetch_array($sql)){ /* Agora, dentro desse while, iremos exibir os dados */ /* var Com os id's */ $id = $info['id']; /* var Com o titulo_home */ $titulo_home = $info['titulo_home']; /* E assim por diante */ /* Agora exibindo um link com o id e o titlo */ echo 'ID:'.$id.'<br>'; echo 'Título:'.$titulo_home; } ?> </div><!--fim conteudo--> <div id="footer"> <!-- INICIO DO RODAPÉ --> <table border="0" cellpadding="0" cellspacing="0" id="rodapet"> <tr> <td width="50%" align="center" valign="bottom" > </td> <td width="1000" height="293" align="center" valign="top" ><table width="840" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="287" height="167" align="left" valign="top"><table width="840" height="167" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="52" align="left" valign="bottom"> </td> <td align="left" valign="middle"> </td> </tr> <tr> <td width="631" height="115" align="left" valign="bottom"><img src="images/logse.png" alt="" width="269" height="115" title="Gafree"/></td> <td width="209" align="left" valign="middle"><a href="http://www.gafree.com.br" class="opacity" title="Clique aqui e Visite a Gafree!"><img src="images/logo_gafree.png" width="100" height="71" border="0" /></a></td> </tr> </table></td> <td align="right" valign="top"> </td> </tr> <tr> <td height="37" colspan="2" align="center" valign="bottom"><a href="index.html" class="menu">Home</a> <span class="menu"> | </span> <a href="quem_sou.html" class="menu">Quem sou eu</a><span class="menu"> |</span> <a href="portifolio.html" class="menu">Galeria</a> <span class="menu"> | </span> <a href="contato.html" class="menu">Eventos</a><span class="menu"> | </span> <a href="contato.html" class="menu">Contato</a></td> </tr> <tr> <td colspan="2" align="center" valign="top" class="menu_sem_efeito">_______________________________________________________________________________</td> </tr> <tr> <td colspan="2" align="center" valign="top" class="rodape"> </td> </tr> <tr> <td height="26" colspan="2" align="center" valign="top" class="rodape"><table width="710" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="26" align="left" valign="top"></a></strong> -É Proibida Copia ou reprodução total ou parcial do conteudo aqui presente.<br /> © 2009 - 2012 |- Todos os direitos reservados.</td> </tr> </table></td> </tr> </table></td> <td width="50%" align="center" valign="top" background="images/rodape_base.gif" style="background-repeat:repeat-x; background-position:top"> </td> </tr> </table> <!-- FIM DO RODAPÉ --></div><!--fim conteudo--> </body> </html> Compartilhar este post Link para o post Compartilhar em outros sites
Gabriel Jacinto 74 Denunciar post Postado Setembro 8, 2012 Primeiramente você fez a conexão com o banco de dados? Compartilhar este post Link para o post Compartilhar em outros sites
Fernando Neto MH 13 Denunciar post Postado Setembro 8, 2012 TENTA ASSIM (NÃO TESTEI) <?php $conn = mysql_connect("localhost","usuario","senha"); mysql_select_db("BANCO",$conn); ?> <body> <div id="topo"> <table id="topota" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="388" align="center"> <div id="wrapper"> <div class="slider-wrapper theme-default"> <div id="slider" class="nivoSlider"> <img src="fotos/slide.png" data-thumb="images/toystory.jpg" alt="" /> <img src="fotos/slide1.png" data-thumb="images/up.jpg" alt="" title="" /> <img src="fotos/slide2.png" data-thumb="images/walle.jpg" alt="" data-transition="slideInLeft" /> <img src="fotos/slide3.png" data-thumb="images/nemo.jpg" alt="" title="" /> <img src="fotos/slide4.png" data-thumb="images/nemo.jpg" alt="" title="" /> <img src="fotos/slide5.png" data-thumb="images/nemo.jpg" alt="" title="" /> </div> <div id="htmlcaption" class="nivo-html-caption"> <strong>This</strong> is an example of a <em>HTML</em> caption with <a href="#">a link</a>. </div> </div> </div> </td> </tr> <tr> <td align="center"> <div id="top"><ul> <li class="selected" ><a href="home.php">Airton Junior</a></li> <li ><a href="agenda.php">Agenda</a></li> <li ><a href="artigos.php">Artigos</a></li> <li ><a href="gale.php">Galeria</a></li> <!--<li ><a href="planos.php">Planos</a></li>--> <li ><a href="mvideos.php">Videos e Musicas</a></li> <li ><a href="contato.php">Contato</a></li> </ul></div> </td> </tr> </table> </div><!--fim topo--> <div id="conteudo"> <?php $sql = mysql_query("SELECT * FROM `home`"); /* Seleciona os dados da tabela */ while($info = mysql_fetch_array($sql)){ /* Agora, dentro desse while, iremos exibir os dados */ /* var Com os id's */ $id = $info['id']; /* var Com o titulo_home */ $titulo_home = $info['titulo_home']; /* E assim por diante */ /* Agora exibindo um link com o id e o titlo */ echo 'ID:'.$id.'<br>'; echo 'Título:'.$titulo_home; } ?> </div><!--fim conteudo--> <div id="footer"> <!-- INICIO DO RODAPÉ --> <table border="0" cellpadding="0" cellspacing="0" id="rodapet"> <tr> <td width="50%" align="center" valign="bottom" > </td> <td width="1000" height="293" align="center" valign="top" ><table width="840" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="287" height="167" align="left" valign="top"><table width="840" height="167" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="52" align="left" valign="bottom"> </td> <td align="left" valign="middle"> </td> </tr> <tr> <td width="631" height="115" align="left" valign="bottom"><img src="images/logse.png" alt="" width="269" height="115" title="Gafree"/></td> <td width="209" align="left" valign="middle"><a href="http://www.gafree.com.br" class="opacity" title="Clique aqui e Visite a Gafree!"><img src="images/logo_gafree.png" width="100" height="71" border="0" /></a></td> </tr> </table></td> <td align="right" valign="top"> </td> </tr> <tr> <td height="37" colspan="2" align="center" valign="bottom"><a href="index.html" class="menu">Home</a> <span class="menu"> | </span> <a href="quem_sou.html" class="menu">Quem sou eu</a><span class="menu"> |</span> <a href="portifolio.html" class="menu">Galeria</a> <span class="menu"> | </span> <a href="contato.html" class="menu">Eventos</a><span class="menu"> | </span> <a href="contato.html" class="menu">Contato</a></td> </tr> <tr> <td colspan="2" align="center" valign="top" class="menu_sem_efeito">_______________________________________________________________________________</td> </tr> <tr> <td colspan="2" align="center" valign="top" class="rodape"> </td> </tr> <tr> <td height="26" colspan="2" align="center" valign="top" class="rodape"><table width="710" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="26" align="left" valign="top"></a></strong> -É Proibida Copia ou reprodução total ou parcial do conteudo aqui presente.<br /> © 2009 - 2012 |- Todos os direitos reservados.</td> </tr> </table></td> </tr> </table></td> <td width="50%" align="center" valign="top" background="images/rodape_base.gif" style="background-repeat:repeat-x; background-position:top"> </td> </tr> </table> <!-- FIM DO RODAPÉ --></div><!--fim conteudo--> </body> </html> Compartilhar este post Link para o post Compartilhar em outros sites
manoaj 12 Denunciar post Postado Setembro 8, 2012 Funciono vlw consegui ! Compartilhar este post Link para o post Compartilhar em outros sites