Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'conexao.php';
- ////select noticias
- if(isset($_GET['id'])){
- $query = mysql_query("SELECT *,date_format(`data`,'%d/%m/%Y') as datap FROM postagem WHERE id=".$_GET['id']) or die(mysql_error());
- $result = mysql_fetch_array($query);
- }else{
- $query = mysql_query("SELECT *,date_format(`data`,'%d/%m/%Y') as datap FROM postagem ORDER BY id DESC") or die(mysql_error());
- }
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <link rel="stylesheet" type="text/css" href="estilo.css"/>
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Tecnologia</title>
- </head>
- <body>
- <div id="principal">
- <?php
- include 'topo.php';
- include 'login.php';
- ?>
- <div id="corpo">
- <div class="input-div" id="input-usuario">
- <h1>Noticias</h1>
- <?php
- if(!isset($_GET['id'])){
- //while do resultado da query $query
- while($noti = mysql_fetch_array($query)){?>
- <span>
- <h2><?=$noti['titulo'];?></h2>
- <br>
- </span>
- <img src="imagem/<?=$noti['imagem'];?>" width="100">
- <br>
- <span id="desc"><?=$noti['texto'];?></span>
- <hr>
- <a href="noticias.php?id=<?=$noti['id'];?>">+detalhes</a>
- <?php }
- }else{?>
- <!-- caso exista id mostra todo a materia-->
- <span>
- <h2><?=$result['titulo'];?></h2>
- <br>
- </span>
- <img src="imagem/<?=$result['imagem'];?>" width="100">
- <br>
- <span id="desc"><?=$result['texto'];?></span>
- <hr>
- <a href="noticias.php?>">« voltar</a>
- <?php }?>
- </div>
- </div>
- <?php
- include 'menu.php';
- include 'rodape.php';
- ?>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment