iviniDesigner

Untitled

Jun 16th, 2013
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.81 KB | None | 0 0
  1. <?php
  2.     include 'conexao.php';
  3.     ////select noticias
  4.     if(isset($_GET['id'])){
  5.          $query = mysql_query("SELECT *,date_format(`data`,'%d/%m/%Y') as datap FROM postagem WHERE id=".$_GET['id']) or die(mysql_error());
  6.          $result = mysql_fetch_array($query);
  7.     }else{
  8.          $query = mysql_query("SELECT *,date_format(`data`,'%d/%m/%Y') as datap FROM postagem ORDER BY id DESC") or die(mysql_error());
  9.     }
  10.        
  11. ?>
  12.  
  13. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  14. <html>
  15. <head>
  16. <link rel="stylesheet" type="text/css" href="estilo.css"/>
  17. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  18.  
  19. <title>Tecnologia</title>
  20. </head>
  21. <body>
  22. <div id="principal">
  23. <?php
  24. include 'topo.php';
  25. include 'login.php';
  26. ?>
  27.  
  28. <div id="corpo">
  29. <div class="input-div" id="input-usuario">
  30.  
  31.         <h1>Noticias</h1>
  32.         <?php
  33.         if(!isset($_GET['id'])){
  34.         //while do resultado da query $query
  35.         while($noti = mysql_fetch_array($query)){?>
  36.         <span>
  37.             <h2><?=$noti['titulo'];?></h2>
  38.         <br>
  39.         </span>
  40.         <img src="imagem/<?=$noti['imagem'];?>" width="100">
  41.         <br>
  42.         <span id="desc"><?=$noti['texto'];?></span>
  43.         <hr>
  44.         <a href="noticias.php?id=<?=$noti['id'];?>">+detalhes</a>
  45.         <?php }
  46.     }else{?>
  47.     <!-- caso exista id mostra todo  a materia-->
  48.     <span>
  49.             <h2><?=$result['titulo'];?></h2>
  50.         <br>
  51.         </span>
  52.         <img src="imagem/<?=$result['imagem'];?>" width="100">
  53.         <br>
  54.         <span id="desc"><?=$result['texto'];?></span>
  55.         <hr>
  56.          <a href="noticias.php?>">&laquo; voltar</a>
  57.     <?php }?>
  58.     </div>
  59.         </div>
  60. <?php
  61. include 'menu.php';
  62. include 'rodape.php';
  63. ?>
  64. </div>
  65. </body>
  66. </html>
Advertisement
Add Comment
Please, Sign In to add comment