Estou conseguindo inserir as noticias normalmente, também consigo visualizá-las, mas de acordo com o tuto o administrador deve dar um "ok" para que as notícias cadastradas sejam colocadas no ar, é nessa parte que não estou conseguindo.
Quando abro o arquivo controle.php, aparece a lista de notícias, como deve ser, mas quando entro no link "alterar" ou mesmo no link "remover" não mostra nada e também não da erro, apenas fica a tela branca, o que pode ser?
Segue o código:
CONTROLE.PHP
<?php
$conexao = mysql_connect("localhost","root","senha");
$db = mysql_select_db("noticias");
$sql = "SELECT * FROM noticias ORDER BY id DESC";
$resultado = mysql_query($sql)
or die ("Não foi possível realizar a consulta ao banco de dados");
echo "<table width=740 border=1 cellpadding=1 cellspacing=1>";
echo "<tr>";
echo "<th width=15>ID:</th>";
echo "<th width=100>Nome:</th>";
echo "<th width=100>Email:</th>";
echo "<th width=30>Data:</th>";
echo "<th width=30>Hora:</th>";
echo "<th width=100>Título:</th>";
echo "<th width=50>Disponível?</th>";
echo "<th width=50>Alterar</th>";
echo "<th width=50>Excluir</th>";
echo "</tr>";
while ($linha=mysql_fetch_array($resultado)) {
$id = $linha["id"];
$nome = $linha["nome"];
$email = $linha["email"];
$data = $linha["data"];
$hora = $linha["hora"];
$titulo = $linha["titulo"];
$ver = $linha["ver"];
$novadata = substr($data,8,2) . "/" .substr($data,5,2) . "/" . substr($data,0,4);
$novahora = substr($hora,0,2) . "h" .substr($hora,3,2) . "min";
echo "<tr>";
echo "<th width=15>$id<br></th>";
echo "<th width=100>$nome<br></th>";
echo "<th width=100>$email<br></th>";
echo "<th width=30>$novadata<br></th>";
echo "<th width=30>$novahora<br></th>";
echo "<th width=100>$titulo<br></th>";
echo "<th width=50>$ver<br></th>";
echo "<th width=50><a href='alterar.php?id=$id'>Alterar</a><br></th>";
echo "<th width=50><a href='excluir.php?id=$id'>Excluir</a><br></th>";
echo "</tr>";
echo "<br>";
}
echo "</table>";
?>
_________________________________________________
ALTERAR.PHP
<?php
$conexao = mysql_connect("localhost","root","senha");
$db = mysql_select_db("noticias");
$sql = "SELECT * FROM noticias WHERE id='$id'";
$resultado = mysql_query($sql)
or die ("Não foi possível realizar a consulta ao banco de dados");
while ($linha=mysql_fetch_array($resultado)) {
$id = $linha["id"];
$nome = $linha["nome"];
$email = $linha["email"];
$data = $linha["data"];
$hora = $linha["hora"];
$titulo = $linha["titulo"];
$subtitulo = $linha["subtitulo"];
$texto = $linha["texto"];
$ver = $linha["ver"];
$novadata = substr($data,8,2) . "/" .substr($data,5,2) . "/" . substr($data,0,4);
$novahora = substr($hora,0,2) . "h" .substr($hora,3,2) . "min";
echo "<h1>Alterar Cadastro...</h1>";
echo "<hr><br>";
echo "<form action='alterar_db.php?id=$id' method='post'>";
echo "Código da Notícia: <input name='id_novo' type='text' value='$id' size=20><br>";
echo "Data: $novadata<br>";
echo "Hora: $novahora<br>";
echo "Nome:<input name='nome_novo' type='text' value='$nome' size=30> *<br>";
echo "Email: <i>(Exemplo: feitosac@yahoo.com)</i><input name='email_novo' type='text'
value='$email' size=30><br><br>";
echo "Título do Texto:<input name='titulo_novo' type='text' value='$titulo' size=30> *<br>";
echo "Subtítulo do Texto:<textarea name='subtitulo_novo' rows=5 cols=30>$subtitulo</textarea><br>";
echo "Texto:<textarea name='texto_novo' rows=10 cols=30>$texto</textarea> *<br>";
echo "Disponibilizar? (on ou off): <input name='ver_novo' type='text' value='$ver' size=5><br>";
echo "<input type='submit' value='Alterar'>";
echo "</form>";
echo "<br><hr>";
}
?>
_______________________________________
Bom, se puderem me ajudar....
Falow galera!
Edição feita por: deqr, 14/06/2007, 09:10.