Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Tipo galera... eu tenho uma tabela com filmes e talz... só que eu quero criar uma página para fazer um editar para cada filme quando precisar.... basicamente vai vai ter uma página com o form que o cara vai digitar o número do filme que quer editar:
CODE
<form id="form1" name="form1" method="post" action="filmes_update2.php">
Digite a ID do filme que você quer editar:
<input type="text" name="id_filme" id="id_filme" maxlength="5" />
<input type="submit" name="procurar" id="procurar" value="Procurar" />
</form>
e depois vai jogar pra outra página que vai montar um formulário para editar as informações...
CODE
<?php
require ('conexao.php');
$seleciona = mysql_query("SELECT * FROM filmes WHERE id_filmes = 'AQUI ESTA A DUVIDA!'") or die (mysql_error());
if (mysql_num_rows($seleciona) == 0) { // se nenhum registro for localizado, exibe a mensagem
die ("<h3>Desculpe, não há nenhum filme com o número de ID " . $_GET["filmes"] . " cadastrado!</h1><h4>Entre em contato com um Administrador ou Moderador para que<br />o problema possa ser resolvido.<br /><br />A equipe Trumps agradece a compreensão.");
}
else { //se for encontrado gera o resultado
while ($dados = mysql_fetch_array($seleciona)) {
// jogandos os dados nas variaveis
$id_filmes = $dados["id_filmes"];
$capa = $dados["capa"];
$nome = $dados["nome"];
$nomebr = $dados["nomebr"];
$ano = $dados["ano"];
$idioma = $dados["idioma"];
$legenda = $dados["legenda"];
$formato = $dados["formato"];
$resolucao = $dados["resolucao"];
$tamanho = $dados["tamanho"];
$sinopse = $dados["sinopse"];
$comentario = $dados["comentario"];
$cred = $dados["cred"];
$select1 = $dados["select1"];
$select2 = $dados["select2"];
$select3 = $dados["select3"];
$select4 = $dados["select4"];
$select5 = $dados["select5"];
$select6 = $dados["select6"];
$select7 = $dados["select7"];
$select8 = $dados["select8"];
$select9 = $dados["select9"];
$select10 = $dados["select10"];
$input1 = $dados["input1"];
$input2 = $dados["input2"];
$input3 = $dados["input3"];
$input4 = $dados["input4"];
$input5 = $dados["input5"];
$input6 = $dados["input6"];
$input7 = $dados["input7"];
$input8 = $dados["input8"];
$input9 = $dados["input9"];
$input10 = $dados["input10"];
}
}
?>
<br /><br /><br /><br /><br />
<style>
<!--
body,td,th {
color: #000000;
}
body {
margin-left: 5px;
margin-top: 5px;
margin-right: 5px;
margin-bottom: 5px;
}
h1,h2,h3,h4,h5,h6 {
font-family: Arial, Helvetica, sans-serif;
}
.style1 {
font-size: 18px;
font-weight: bold;
}
.input{
azimuth:center
}
-->
</style><form name="formfilm" id="formfilm" method="post" action="filmes_cadastro2.php"><table width="785" border="0" bgcolor="#CCCCCC">
<tr>
<td colspan="2"><div align="center" class="style1">Gerador de Conteudo Padronizado - Filmes</div></td>
</tr>
<tr>
<td width="206">Imagem do Pôster, link:</td>
<td width="569"><input name="capa" type="text" id="capa" value="<? echo $capa ?>" size="75"></td>
</tr>
<tr>
<td>Nome do Filme, original:</td>
<td>
<input name="nome" type="text" id="nome" value="<? echo $nome ?>" size="75" maxlength="40"> </td>
</tr>
<tr>
<td>Nome do Filme, no brasil:</td>
<td>
<input name="nomebr" type="text" id="nomebr" value="<? echo $nomebr ?>" size="75" maxlength="40"> </td>
</tr>
<tr>
<td>Ano de Lançamento:</td>
<td>
<input name="ano" type="text" id="ano" value="<? echo $ano ?>" size="6" maxlength="4"> </td>
</tr>
<tr>
<td>Idioma, Áudio:</td>
<td>
<input name="idioma" type="text" id="idioma" value="<? echo $idioma ?>" size="25" maxlength="25"> </td>
</tr>
<tr>
<td>Legenda:</td>
<td>
<input name="legenda" type="text" id="legenda" value="<? echo $legenda ?>" size="25" maxlength="25"> </td>
</tr>
<tr>
<td>Formato:</td>
<td><input name="formato" type="text" id="formato" value="<? echo $formato ?>" size="25" maxlength="25" /></td>
</tr>
<tr>
<td>Resolução:</td>
<td>
<input name="resolucao" type="text" id="resolucao" value="<? echo $resolucao ?>" size="25" maxlength="25"> </td>
</tr>
<tr>
<td>Tamanho total:</td>
<td><input name="tamanho" type="text" id="tamanho" value="<? echo $tamanho ?>" size="25" maxlength="25" /></td>
</tr>
<tr>
<td valign="top">Sinopse:</td>
<td>
<textarea name="sinopse" cols="72" rows="5" id="sinopse"><? echo $sinopse ?></textarea> </td>
</tr>
<tr>
<td valign="top">Comentário:</td>
<td>
<textarea name="comentario" cols="72" rows="3" id="comentario"><? echo $comentario ?></textarea> </td>
</tr>
<tr>
<td>Créditos a:</td>
<td>
<input name="cred" type="text" id="cred" value="<? echo $cred ?>" size="75" maxlength="100"> </td>
</tr>
<tr>
<td colspan="2"><div align="center"><strong>. . . : : Links : : . . .</strong></div></td>
</tr>
<tr>
<td><select name="select1" id="select1">
<option value="Link sem especificação" selected="selected">Escolha uma opção</option>
<option value="Download - Arquivo Único - Opção 1">Download - Arquivo Único - Opção 1</option>
<option value="Download - Arquivo Único - Opção 2">Download - Arquivo Único - Opção 2</option>
<option value="Download - Legenda">Download - Legenda</option>
<option value="Download - Por Torrent">Download - Por Torrent</option>
<option value="Download - Parte 1">Download - Parte 1</option>
<option value="Download - Parte 2">Download - Parte 2</option>
<option value="Download - Parte 3">Download - Parte 3</option>
<option value="Download - Parte 4">Download - Parte 4</option>
<option value="Download - Parte 5">Download - Parte 5</option>
<option value="Download - Parte 6">Download - Parte 6</option>
<option value="Download - Parte 7">Download - Parte 7</option>
<option value="Download - Parte 8">Download - Parte 8</option>
</select></td>
<td><input name="input1" type="text" id="input1" value="<? echo $input1 ?>" size="75" /></td>
</tr>
<tr>
<td><select name="select2" id="select2">
<option value="Link sem especificação" selected="selected">Escolha uma opção</option>
<option value="Download - Arquivo Único - Opção 1">Download - Arquivo Único - Opção 1</option>
<option value="Download - Arquivo Único - Opção 2">Download - Arquivo Único - Opção 2</option>
<option value="Download - Legenda">Download - Legenda</option>
<option value="Download - Por Torrent">Download - Por Torrent</option>
<option value="Download - Parte 1">Download - Parte 1</option>
<option value="Download - Parte 2">Download - Parte 2</option>
<option value="Download - Parte 3">Download - Parte 3</option>
<option value="Download - Parte 4">Download - Parte 4</option>
<option value="Download - Parte 5">Download - Parte 5</option>
<option value="Download - Parte 6">Download - Parte 6</option>
<option value="Download - Parte 7">Download - Parte 7</option>
<option value="Download - Parte 8">Download - Parte 8</option>
</select></td>
<td><input name="input2" type="text" id="input2" value="<? echo $input2 ?>" size="75" /></td>
</tr>
<tr>
<td><select name="select3" id="select3">
<option value="Link sem especificação" selected="selected">Escolha uma opção</option>
<option value="Download - Arquivo Único - Opção 1">Download - Arquivo Único - Opção 1</option>
<option value="Download - Arquivo Único - Opção 2">Download - Arquivo Único - Opção 2</option>
<option value="Download - Legenda">Download - Legenda</option>
<option value="Download - Por Torrent">Download - Por Torrent</option>
<option value="Download - Parte 1">Download - Parte 1</option>
<option value="Download - Parte 2">Download - Parte 2</option>
<option value="Download - Parte 3">Download - Parte 3</option>
<option value="Download - Parte 4">Download - Parte 4</option>
<option value="Download - Parte 5">Download - Parte 5</option>
<option value="Download - Parte 6">Download - Parte 6</option>
<option value="Download - Parte 7">Download - Parte 7</option>
<option value="Download - Parte 8">Download - Parte 8</option>
</select></td>
<td><input name="input3" type="text" id="input3" value="<? echo $input3 ?>" size="75" /></td>
</tr>
<tr>
<td><select name="select4" id="select4">
<option value="Link sem especificação" selected="selected">Escolha uma opção</option>
<option value="Download - Arquivo Único - Opção 1">Download - Arquivo Único - Opção 1</option>
<option value="Download - Arquivo Único - Opção 2">Download - Arquivo Único - Opção 2</option>
<option value="Download - Legenda">Download - Legenda</option>
<option value="Download - Por Torrent">Download - Por Torrent</option>
<option value="Download - Parte 1">Download - Parte 1</option>
<option value="Download - Parte 2">Download - Parte 2</option>
<option value="Download - Parte 3">Download - Parte 3</option>
<option value="Download - Parte 4">Download - Parte 4</option>
<option value="Download - Parte 5">Download - Parte 5</option>
<option value="Download - Parte 6">Download - Parte 6</option>
<option value="Download - Parte 7">Download - Parte 7</option>
<option value="Download - Parte 8">Download - Parte 8</option>
</select></td>
<td><input name="input4" type="text" id="input4" value="<? echo $input4 ?>" size="75" /></td>
</tr>
<tr>
<td><select name="select5" id="select5">
<option value="Link sem especificação" selected="selected">Escolha uma opção</option>
<option value="Download - Arquivo Único - Opção 1">Download - Arquivo Único - Opção 1</option>
<option value="Download - Arquivo Único - Opção 2">Download - Arquivo Único - Opção 2</option>
<option value="Download - Legenda">Download - Legenda</option>
<option value="Download - Por Torrent">Download - Por Torrent</option>
<option value="Download - Parte 1">Download - Parte 1</option>
<option value="Download - Parte 2">Download - Parte 2</option>
<option value="Download - Parte 3">Download - Parte 3</option>
<option value="Download - Parte 4">Download - Parte 4</option>
<option value="Download - Parte 5">Download - Parte 5</option>
<option value="Download - Parte 6">Download - Parte 6</option>
<option value="Download - Parte 7">Download - Parte 7</option>
<option value="Download - Parte 8">Download - Parte 8</option>
</select></td>
<td><input name="input5" type="text" id="input5" value="<? echo $input5 ?>" size="75" /></td>
</tr>
<tr>
<td><select name="select6" id="select6">
<option value="Link sem especificação" selected="selected">Escolha uma opção</option>
<option value="Download - Arquivo Único - Opção 1">Download - Arquivo Único - Opção 1</option>
<option value="Download - Arquivo Único - Opção 2">Download - Arquivo Único - Opção 2</option>
<option value="Download - Legenda">Download - Legenda</option>
<option value="Download - Por Torrent">Download - Por Torrent</option>
<option value="Download - Parte 1">Download - Parte 1</option>
<option value="Download - Parte 2">Download - Parte 2</option>
<option value="Download - Parte 3">Download - Parte 3</option>
<option value="Download - Parte 4">Download - Parte 4</option>
<option value="Download - Parte 5">Download - Parte 5</option>
<option value="Download - Parte 6">Download - Parte 6</option>
<option value="Download - Parte 7">Download - Parte 7</option>
<option value="Download - Parte 8">Download - Parte 8</option>
</select></td>
<td><input name="input6" type="text" id="input6" value="<? echo $input6 ?>" size="75" /></td>
</tr>
<tr>
<td><select name="select7" id="select7">
<option value="Link sem especificação" selected="selected">Escolha uma opção</option>
<option value="Download - Arquivo Único - Opção 1">Download - Arquivo Único - Opção 1</option>
<option value="Download - Arquivo Único - Opção 2">Download - Arquivo Único - Opção 2</option>
<option value="Download - Legenda">Download - Legenda</option>
<option value="Download - Por Torrent">Download - Por Torrent</option>
<option value="Download - Parte 1">Download - Parte 1</option>
<option value="Download - Parte 2">Download - Parte 2</option>
<option value="Download - Parte 3">Download - Parte 3</option>
<option value="Download - Parte 4">Download - Parte 4</option>
<option value="Download - Parte 5">Download - Parte 5</option>
<option value="Download - Parte 6">Download - Parte 6</option>
<option value="Download - Parte 7">Download - Parte 7</option>
<option value="Download - Parte 8">Download - Parte 8</option>
</select></td>
<td><input name="input7" type="text" id="input7" value="<? echo $input7 ?>" size="75" /></td>
</tr>
<tr>
<td><select name="select8" id="select8">
<option value="Link sem especificação" selected="selected">Escolha uma opção</option>
<option value="Download - Arquivo Único - Opção 1">Download - Arquivo Único - Opção 1</option>
<option value="Download - Arquivo Único - Opção 2">Download - Arquivo Único - Opção 2</option>
<option value="Download - Legenda">Download - Legenda</option>
<option value="Download - Por Torrent">Download - Por Torrent</option>
<option value="Download - Parte 1">Download - Parte 1</option>
<option value="Download - Parte 2">Download - Parte 2</option>
<option value="Download - Parte 3">Download - Parte 3</option>
<option value="Download - Parte 4">Download - Parte 4</option>
<option value="Download - Parte 5">Download - Parte 5</option>
<option value="Download - Parte 6">Download - Parte 6</option>
<option value="Download - Parte 7">Download - Parte 7</option>
<option value="Download - Parte 8">Download - Parte 8</option>
</select></td>
<td><input name="input8" type="text" id="input8" value="<? echo $input8 ?>" size="75" /></td>
</tr>
<tr>
<td><select name="select9" id="select9">
<option value="Link sem especificação" selected="selected">Escolha uma opção</option>
<option value="Download - Arquivo Único - Opção 1">Download - Arquivo Único - Opção 1</option>
<option value="Download - Arquivo Único - Opção 2">Download - Arquivo Único - Opção 2</option>
<option value="Download - Legenda">Download - Legenda</option>
<option value="Download - Por Torrent">Download - Por Torrent</option>
<option value="Download - Parte 1">Download - Parte 1</option>
<option value="Download - Parte 2">Download - Parte 2</option>
<option value="Download - Parte 3">Download - Parte 3</option>
<option value="Download - Parte 4">Download - Parte 4</option>
<option value="Download - Parte 5">Download - Parte 5</option>
<option value="Download - Parte 6">Download - Parte 6</option>
<option value="Download - Parte 7">Download - Parte 7</option>
<option value="Download - Parte 8">Download - Parte 8</option>
</select></td>
<td><input name="input9" type="text" id="input9" value="<? echo $input9 ?>" size="75" /></td>
</tr>
<tr>
<td><select name="select10" id="select10">
<option value="Link sem especificação" selected="selected">Escolha uma opção</option>
<option value="Download - Arquivo Único - Opção 1">Download - Arquivo Único - Opção 1</option>
<option value="Download - Arquivo Único - Opção 2">Download - Arquivo Único - Opção 2</option>
<option value="Download - Legenda">Download - Legenda</option>
<option value="Download - Por Torrent">Download - Por Torrent</option>
<option value="Download - Parte 1">Download - Parte 1</option>
<option value="Download - Parte 2">Download - Parte 2</option>
<option value="Download - Parte 3">Download - Parte 3</option>
<option value="Download - Parte 4">Download - Parte 4</option>
<option value="Download - Parte 5">Download - Parte 5</option>
<option value="Download - Parte 6">Download - Parte 6</option>
<option value="Download - Parte 7">Download - Parte 7</option>
<option value="Download - Parte 8">Download - Parte 8</option>
</select></td>
<td><input name="input10" type="text" id="input10" value="<? echo $input10 ?>" size="75" /></td>
</tr>
<tr>
<td colspan="2"><table width="764" border="0">
<tr>
<td width="219"> </td>
<td width="145"><input type="reset" name="reset" id="reset" value="Redefinir dados" /></td>
<td width="386"><input type="submit" name="enviar" id="enviar" value="Inserir no db" /></td>
</tr>
</table>
<div></div></td>
</tr>
</table>
</form>
Agora olhem o formulário, vocês vão entender.... como eu faço pra pegar o id do filme de acordo com o que o cara digitar?... e existe uma maneira mais fácil de fazer um formulário de editar?
e depois e só fazer um insert normal?
ajuda ai galera...
Tenho este para notícias, basta você analisá-lo e adapta-lo ao seu, veja se reolve:
admnoticias.php
CODE
<html>
<head>
<title>Administrando as notícias</title>
<script language="javascript">
function Direciona(botao)
{
var pagina;
if (botao == 1)
pagina = "excluirnoticias.php"
else if (botao == 2)
pagina = "updatenoticias.php"
document.getElementById("noticias").action = pagina;
document.getElementById("noticias").submit();
}
</script>
</head>
<body bgcolor="#DFDFBF">
<font style="tahoma" size="5">
<p align="center">
Administração de Notícias
</p>
</font>
<ul>
<li>Dica(1): Para pular uma linha coloque<img src="img/br.gif" border="0">após o texto. Exemplo: ...estava além do limite.<img src="img/br.gif" border="0"></li>
<li>Dica(2): Para pular duas linhas ou iniciar um novo parágrafo coloque<img src="img/p.gif" border="0">após o texto. Exemplo: ...e foi assim que se concretizou!<img src="img/p.gif" border="0"></li><p>
</ul>
<table border="0" width="100%">
<tr>
<td width="50%" valign="top" bgcolor="#DFDFBF">
<form method="submit" name="incluirnoticia" action="incluirnoticias.php" target="quadronoticias">
<font style="tahoma" size="4">
Título: <input type="text" name="titulo" value="" size="51" maxlength="50">
<br>Campo da Notícia<br>
<textarea name="conteudo" rows="8" cols="100"></textarea>
<br><br>
<input onmouseover=this.style.cursor="hand" type="submit" name="incluir" value="Incluir" style="border:0;height:20;width:72;background:#E8F3FD">
</font>
</form>
<form method="submit" id="noticias" name="exluirnoticia" action="excluirnoticias.php" target="quadronoticias">
<font style="tahoma size="1">
Notícia Nº: <input type="text" name="registro" value="" size="10">
<input onmouseover=this.style.cursor="hand" type="submit" name="excluir" value="Excluir" style="border:0;height:20;width:72;background:#E8F3FD" onclick="Direciona(1)">
<input onmouseover=this.style.cursor="hand" type="submit" name="editar" value="Editar" style="border:0;height:20;width:72;background:#E8F3FD" onclick="Direciona(2)">
</font>
</form>
</td>
</tr>
<tr>
<td>
<form method="submit" name="listarnoticias" action="listarnoticias.php" target="quadronoticias">
<p align="center"><input onmouseover=this.style.cursor="hand" type="submit" name="listar" value="Listar Notícias Cadastradas" style="border:0;height:18;width:175;background:#E8F3FD"></p></form>
<iframe align="center" name="quadronoticias" frameborder="0" valign="top" scrolling="1" height="350" src="listarnoticias.php" width="100%">
Seu Navegador NÃO oferece suporte a quadros!
</iframe>
</td>
</tr>
</table>
<p><br><center>
<a href="adm.php"><img src="img/btnvoltar.gif" border="0" alt="Voltar" value="Voltar"></a>
</center>
</body>
</html>
incluirnoticias.php
CODE
<html>
<head>
<title>Incluir Notícias</title>
</head>
<body bgcolor="#DFDFBF">
<?php
include "base.php";
$result=mysql_query('insert into ultimasnoticias(titulo,conteudo) values("'.$_REQUEST["titulo"].'","'.$_REQUEST["conteudo"].'");',$conexao) or die ("erro 001" . mysql_error());
if ($result)
{
echo '<script language="Javascript">alert("OPERAÇÃO EFETUADA COM SUCESSO!");self.location.href="listarnoticias.php"</script>';
}
else
{
echo '<script language="Javascript">alert("ERRO NA OPERAÇÃO! CONTACTE O ADMINISTRADOR DO SISTEMA");self.location.href="listarnoticias.php"</script>';
}
?>
</body>
</html>
excluirnoticias.php
CODE
<html>
<head>
<title>Excluir Notícias</title>
</head>
<body bgcolor="#DFDFBF">
<?php
include "base.php";
$result=mysql_query('delete from ultimasnoticias where registro="'.$_REQUEST["registro"].'";',$conexao) or die ("erro 001" . mysql_error());
if ($result)
{
echo '<script language="Javascript">alert("OPERAÇÃO EFETUADA COM SUCESSO!");self.location.href="listarnoticias.php"</script>';
}
else
{
echo '<script language="Javascript">alert("ERRO NA OPERAÇÃO! CONTACTE O ADMINISTRADOR DO SISTEMA");self.location.href="listarnoticias.php"</script>';
}
?>
</body>
</html>
listarnoticias.php
CODE
<html>
<head>
<title>Listar Notícias</title>
</head>
<body>
<table border="0" width="100%" colspacing="0">
<tr>
<td>
<?php
include ("base.php");
$result=mysql_query('select * from ultimasnoticias order by registro;',$conexao) or die ("erro 001" . mysql_error());
$quantos=mysql_num_rows($result);
$i=0;
echo '<table border="1" width="100%">';
echo '<tr><td width="15" bgcolor="#FFFFC0"><b>Notícia</b>';
echo '</td><td width="50" bgcolor="#FFFFC0"><b>Título</b>';
echo '</td><td bgcolor="#FFFFC0"><b>Conteúdo</b></td>';
for ($i==0; $i<$quantos; $i++)
{
echo '<tr><td>';
echo '<span style="font-size:8.0pt;font-family:verdana;color:#000080">';
echo '<center>';echo mysql_result($result,$i,registro);echo '</center>';
echo '</td><td>';
echo '<pre>';echo mysql_result($result,$i,titulo);echo '</pre>';
echo '</td><td>';
echo '<pre>';echo mysql_result($result,$i,conteudo);echo '</pre>';
echo '</td></tr>';
}
echo '</table>';
?>
</td>
</tr>
</table>
</body>
</html>
updatenoticias.php
CODE
<html>
<head>
<title>Notícias Atualização</title>
</head>
<body bgcolor="#DFDFBF" link="#DFDFBF" alink="#DFDFBF" vlink="#DFDFBF">
<?php
include ("base.php");
$result=mysql_query ('select * from ultimasnoticias where registro="'.$_REQUEST["registro"].'";',$conexao) or die ("erro 001" . mysql_error());
$quantos=mysql_num_rows($result);
$i=0;
echo '<center>';
for ($i==0; $i<$quantos; $i++)
{
echo '<table border="1" width="100%">';
echo '<tr>';
echo '<td width="50%" valign="top" bgcolor="#DFDFBF">';
echo '<font style="tahoma" size="3"><b>';
echo '<center>Atualização de Notícia</center></b></font>';
echo '<form method="post" name="atualizar" action="atualizarnoticias.php">';
echo '<h4><b>Notícia Nº '.mysql_result($result,$i,registro).'</b></h4>';
echo '<b><u>Título:</u></b> <input type="text" name="titulo" value="'.mysql_result($result,$i,titulo).'" size="50" maxlength="30">';
echo '<h4><u>Campo da notícia:</u></h4>';
echo '<textarea name="conteudo" rows="8" cols="100">'.mysql_result($result,$i,conteudo).'</textarea><p>';
echo '<hr>';
$identificador=mysql_query('truncate table identificador;',$conexao) or die ("erro 001" . mysql_error());
$insere=mysql_query('insert into identificador (id) values ("'.$_REQUEST["registro"].'");',$conexao) or die ("erro 001" . mysql_error());
echo '<input type="image" src="img/btnsalvar.gif" border="0" alt="Salvar" name="salvar" value="Salvar">';
echo '<img src="img/espaco.gif" border="0">';
echo '<a href="listarnoticias.php" target="quadronoticias"><img src="img/btncancelar.gif" alt="Cancelar" name="cancelar" value="Cancelar" border="0"></a>';
echo '</form>';
echo '</font>';
echo '</td>';
echo '</tr>';
echo '</table>';
}
echo '</center>';
?>
</body>
</html>
atualizarnoticias.php
CODE
<html>
<head>
<title>ATUALIZAR NOTÍCIAS</title>
</head>
<body bgcolor="#DFDFBF" link="#DFDFBF" alink="#DFDFBF" vlink="#DFDFBF">
<?php
include ("base.php");
$id=mysql_query ("select * from identificador;",$conexao) or die ("erro 001" . mysql_error());
$id1=mysql_result($id,id);
$result=mysql_query('update ultimasnoticias set titulo="'.$_REQUEST["titulo"].'", conteudo="'.$_REQUEST["conteudo"].'" where registro='.$id1.';',$conexao) or die ("erro 001" . mysql_error());
if ($result)
{
echo '<script language="Javascript">alert("OPERAÇÃO EFETUADA COM SUCESSO!");self.location.href="listarnoticias.php"</script>';
}
else
{
echo '<script language="Javascript">alert("ERRO NA OPERAÇÃO! CONTACTE O ADMINISTRADOR DO SISTEMA");self.location.href="listarnoticias.php"</script>';
}
?>
</body>
</html>
tabelas.php
CODE
<?php
include ('base.php');
$ultimasnoticias=mysql_query('create table ultimasnoticias (registro integer primary key auto_increment,
titulo varchar(50),
conteudo text);',$conexao) or die ("erro 001" . mysql_error());
$identificador=mysql_query('create table identificador (id integer);',$conexao) or die ("erro 001" . mysql_error());
if ($ultimasnoticias)
{
echo 'Tabela Últimas Noticias criada com sucesso!<br>';
}
else
{
echo 'Erro ao criar tabela Últimas Noticias. Veja o código!<br>';
}
if ($identificador)
{
echo 'Tabela Identificador criada com sucesso!<br>';
}
else
{
echo 'Erro ao criar tabela Identificador. Veja o código!<br>';
}
?>
Obs.: o include "base.php" é o que faz a conexão com o BD:
base.php
CODE
<?php
$conexao=mysql_connect('localhost','aqui vai o usuario',' aqui vai a senha');
mysql_select_db('aqui vai o nome do seu BD',$conexao) or die ("erro 001" . mysql_error());
?>
Primeiro rode o tabelas.php para criar as tabelas e depois o admnoticias. Ai adapte ao seu código. Espero que te ajude, ok?
Um bom domingo para você!
Zangoliers
tente isso
acho q resolve