Continua deixando todos os registros do ID em branco...
Edição feita por: boari, 27/10/2004, 13:28.
Posted 27/10/2004, 13:27
Edição feita por: boari, 27/10/2004, 13:28.
Posted 27/10/2004, 14:06
PHP |
<?php $NickName = 'Atentado'; $ICQ = '339591460'; $MSN = 'pauloimmig@msn.com ?> |
Posted 27/10/2004, 14:24
Então,O que tu quer exibir naum deveria estar dentro de um form ou de um while?não te esquece q para mostrar os dados tu precisa de uma estrutura de repetição!
PHP |
<? echo $linha["data"]; ?> |
PHP |
<?php data='".$_POST['data']."',local='".$_POST['local']."',descricao='".$_POST['descricao']."',horario='".$_POST['horario']."' ?> |
Edição feita por: boari, 27/10/2004, 14:25.
Posted 27/10/2004, 15:07
PHP |
<?php data='".$_POST['data']."',local='".$_POST['local']."',descricao='".$_POST['descricao']."',horario='".$_POST['horario']."' ?> |
PHP |
<?php data=$_POST['data'].',local='.$_POST['local'].',descricao='.$_POST['descricao'].',horario='.$_POST['horario']; ?> |
PHP |
<?php $NickName = 'Atentado'; $ICQ = '339591460'; $MSN = 'pauloimmig@msn.com ?> |
Posted 27/10/2004, 16:37
PHP |
<? include("config.php"); // conexao ?> <? $muda = mysql_query("UPDATE shows SET data=$_POST['data'].',local='.$_POST['local'].',descricao='.$_POST['descricao'].',horario='.$_POST['horario']; WHERE id='$_GET[id]'",$link); echo ($muda==true) ? "Modificado!" : "Erro ao modificar!"; ?> |
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in c:\arquivos de programas\easyphp1-7\www\conexao\novo\_mudou.php on line 4
Posted 27/10/2004, 16:46
PHP |
<? include("config.php"); // conexao ?> <? $data = $_POST['data']; $local = $_POST['local']; $descricao = $_POST['descricao']; $horario = $_POST['horario']; $id = $_GET['id']; $muda = mysql_query('UPDATE shows SET data='.$data.', local='.$local.', descricao='.$descricao.', horario='.$horario.' WHERE id= '.$id); echo ($muda==true) ? "Modificado!" : "Erro ao modificar!"; ?> |
Edição feita por: Atentado, 27/10/2004, 16:53.
PHP |
<?php $NickName = 'Atentado'; $ICQ = '339591460'; $MSN = 'pauloimmig@msn.com ?> |
Posted 27/10/2004, 17:15
PHP |
<? include("config.php"); // conexao ?> <? $data = $_POST['data']; $local = $_POST['local']; $descricao = $_POST['descricao']; $horario = $_POST['horario']; $id = $_GET['id']; $muda = mysql_query('UPDATE shows SET data='.$data.', local='.$local.', descricao='.$descricao.', horario='.$horario.' WHERE id='.$id,$link); echo ($muda==true) ? "Modificado!" : "Erro ao modificar!"; ?> |
Erro ao modificar!
Edição feita por: boari, 27/10/2004, 17:16.
Posted 27/10/2004, 17:18
PHP |
<?php $NickName = 'Atentado'; $ICQ = '339591460'; $MSN = 'pauloimmig@msn.com ?> |
Posted 27/10/2004, 17:33
pois ébom, metade do prolema solucionado, a query ta certa, testa com o $link, pode ser isso!
Posted 27/10/2004, 17:35
PHP |
<?php $NickName = 'Atentado'; $ICQ = '339591460'; $MSN = 'pauloimmig@msn.com ?> |
Posted 27/10/2004, 17:52
PHP |
<?php $link = mysql_connect("localhost", "root", "") or die("Não foi possível conectar ao servidor"); mysql_select_db("mmb") or die("Não foi possível selecionar o banco de dados"); ?> |
PHP |
<html> <head> <style type="text/css"> <!-- BODY { color: #666666; margin: 0px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size : 10px; } .form {BORDER-RIGHT: #dddddd 1px solid; BORDER-TOP: #cccccc 1px solid; FONT-SIZE: 8pt; BACKGROUND: #fdfdfd; BORDER-LEFT: #cccccc 1px solid; COLOR: #666666; BORDER-BOTTOM: #dddddd 1px solid; FONT-FAMILY: Tahoma, Verdana } --> </style> </head> <body> <p align="center"><font size="2"><strong>Administração </strong></font></p> <p> <?php include("config.php"); if ($id) { $resultado = mysql_query("SELECT * FROM shows WHERE id=$id",$link); $linha = mysql_fetch_array($resultado); } else { $resultado = mysql_query("SELECT * FROM shows",$link); if ($linha = mysql_fetch_array($resultado)) { do { echo $linha["local"], " - ", $linha["data"]; echo " - "; printf("<a href=_deleta.php%s?id=%s>deleta</a> ", $PHP_SELF, $linha["id"], $linha["local"], $linha["data"]); printf("<a href=_muda.php%s?id=%s>muda</a><br>\n", $PHP_SELF, $linha["id"], $linha["local"], $linha["data"]); } while ($linha = mysql_fetch_array($resultado)); } else { echo "Nenhum registro encontrado!"; } } ?> <br> <input name='botao' type="submit" class="form" id="botao" onclick="window.location=('inserir.php')" value="Inserir novo"> </p> </body> </html> |
PHP |
<? //DADOS DA CONEXÃO COM O BD include("config.php"); //APAGANDO OS DADOS $apaga = mysql_query("DELETE FROM shows WHERE id='$_GET[id]'",$link); //MENSAGEM echo ($apaga==true) ? "Dados excluídos com sucesso!!!!" : "Erro ao exluir dados!"; ?> |
PHP |
<html> <body> <? include("config.php"); $resultado = mysql_query("SELECT * FROM shows WHERE id='$_GET[id]'",$link); $linha = mysql_fetch_array($resultado); ?> <table width=100% cellpading=0 cellspacing=0> <form name="form1" method="post" action="_mudou.php?id=<?=$_GET[id]?>"><tr> <td><input type="text" value=<? echo $linha["local"]; ?> name="textfield"></td> <td><input type="text" value=<? echo $linha["data"]; ?> name="textfield"></td> <td><input type="text" value=<? echo $linha["horario"]; ?> name="textfield"></td> <td><input type="text" value=<? echo $linha["descricao"]; ?> name="textfield"></td> <td><input type="submit" name="submit" value=" Modificar >>> "></td> </tr></form> </table> </body> </html> |
PHP |
<? include("config.php"); // conexao ?> <? $data = $_POST['data']; $local = $_POST['local']; $descricao = $_POST['descricao']; $horario = $_POST['horario']; $id = $_GET['id']; $muda = mysql_query('UPDATE shows SET data='.$data.', local='.$local.', descricao='.$descricao.', horario='.$horario.' WHERE id= '.$id,$link); echo ($muda==true) ? "Modificado!" : "Erro ao modificar!"; ?> |
PHP |
<?php <html> <head><style type="text/css"> <!-- BODY { color: #666666; margin: 0px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size : 10px; } .form {BORDER-RIGHT: #dddddd 1px solid; BORDER-TOP: #cccccc 1px solid; FONT-SIZE: 8pt; BACKGROUND: #fdfdfd; BORDER-LEFT: #cccccc 1px solid; COLOR: #666666; BORDER-BOTTOM: #dddddd 1px solid; FONT-FAMILY: Tahoma, Verdana } --> </style> </head> <body> <form name="form1" method="post" action="_dados.php"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td width="70"><font size="2" face="Geneva, Arial, Helvetica, sans-serif">Data: <br> </font></td> <td width="144"> <input name="txt_data" type="text" id="txt_data" class="form"> </td> </tr> <tr> <td><font size="2" face="Geneva, Arial, Helvetica, sans-serif">Local:</font></td> <td><input name="txt_local" type="text" id="txt_local2" class="form"></td> </tr> <tr> <td><font size="2" face="Geneva, Arial, Helvetica, sans-serif">Descrição: </font></td> <td><input name="txt_descricao" type="text" id="txt_descricao2" class="form"></td> </tr> <tr> <td><font size="2" face="Geneva, Arial, Helvetica, sans-serif">Horario:</font></td> <td><input name="txt_horario" type="text" id="txt_horario2" class="form"></td> </tr> <tr> <td colspan="2"><br> <input name="Submit" type="submit" class="form" value="Enviar dados >>>"></td> </tr> </table> </form> </body> </html> ?> |
PHP |
<? //PEGA OS DADOS DA CONEXÃO COM O BD include("config.php"); //PEGA OS DADOS ENVIADOS PELO FORMULÁRIO $data = $_POST["txt_data"]; $local = $_POST["txt_local"]; $descricao = $_POST["txt_descricao"]; $horario = $_POST["txt_horario"]; //INSERINDO OS DADOS DO FORMULARIO NO BANCO DE DADOS mysql_query("INSERT INTO shows (data, local, descricao, horario) VALUES ('$data', '$local', '$descricao', '$horario')"); //MENSAGEM DE SUCESSO echo "Dados inseridos com sucesso!"; ?> |
PHP |
<html> <head> <style type="text/css"> <!-- BODY { color: #666666; margin: 0px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size : 10px; } --> </style> </head> <body> <? //PEGA OS DADOS DA CONEXÃO COM O BD include("config.php"); //CONSULTA $s = mysql_query("SELECT * FROM shows LIMIT 0,3"); $n = mysql_num_rows($s); if($n == "0"){ echo 'Não há dados cadastrados!'; } else { while($x = mysql_fetch_array($s)){ echo '<b>Data:</b> '.$x[data].'<br><b>Local:</b> '.$x[local].'<br><b>Descricao:</b> '.$x[descricao].'<br><b>Horário:</b> '.$x[horario].'<br><br>'; } } ?> </body> </html> |
Edição feita por: boari, 27/10/2004, 17:54.
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)