Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

drizimm

Atualizando banco de dados

Recommended Posts

e ae pessoal !

 

seguinte, to fazendo um sistema de onde o usuario cadastrado preenche um formulario, os dados vao para a tabela perfil do MySQL e uma pagina exibe os dados. ai eu fiz uma pagina alterar.php para caso o usuario queira mudar algum dado depois de um tempo, ele acessar essa pagina e modificar o dado que quiser. só que o problema eh que quando eu testei, deu TUDO certo, naum apareceu nenhuma mensagem de erro, mais ao verificar os dados da tabela no PhpMyAdmin, vi que naum mudou nada. vou colocar o codigo aqui e gostaria muito que alguem pudesse me dizer aonde está o erro. valeeeeu ! x)

 

alterar.php

<?

include("conectar.php");

    cabecalho("ZiMM :: AREA DE MANUTENÇÃO","");

$vars = $HTTP_SESSION_VARS['username'];

$query = mysql_query("SELECT * FROM perfil where username='$vars'");

$linha = mysql_fetch_array($query);

?>

<head>

<style type='text/css'>

<!--

-->

</style>

<link href='../style1.css' rel='stylesheet' type='text/css'>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>

<body leftmargin="0" topmargin="0">

<table border="0" cellpadding="0" cellspacing="0" width="766">

  <tr>

    <td width="250"><img src="spacer.gif" alt="" name="undefined_2" width="250" height="1" border="0"></td>

    <td width="304"><img src="spacer.gif" alt="" name="undefined_2" width="304" height="1" border="0"></td>

    <td width="211"><img src="spacer.gif" alt="" name="undefined_2" width="211" height="1" border="0"></td>

    <td width="10"><img src="spacer.gif" alt="" name="undefined_2" width="1" height="1" border="0"></td>

  </tr>

  <tr>

    <td valign="top" bgcolor="#333333"><p>

        <map name="undefined_2Map">

          <area shape="rect" coords="97,1,190,16" href="criar.php">

          <area shape="rect" coords="107,20,193,39" href="http://www.polarhome.com/%7Ezimm2004/perfil.php?id=$id">

          <area shape="rect" coords="80,44,193,62" href="alterar.php">

        </map>

      </p></td>

    <td colspan="2"><img name="perfil_r1_c2_2" src="perfil_r1_c2.gif" width="515" height="89" border="0" alt=""></td>

    <td><img src="spacer.gif" alt="" name="undefined_2" width="1" height="89" border="0"></td>

  </tr>

  <tr>

    <td rowspan="2" colspan="2" valign="top" bgcolor="#333333"><form name="alterar" method="post" action="alterar_db.php">

        <table width="77%" border="0" align="left" cellpadding="0" cellspacing="5">

          <tr>

            <td bgcolor="#CC6600"> <div align="right"><font color="#FFFFFF" size="2" face="Tahoma">CRIAR

                PERFIL ** </font></div></td>

          </tr>

          <tr>

            <td align="right"><div align="right">

                <table width="65%" border="0" cellspacing="00" cellpadding="00">

                  <tr>

                    <td width="68%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">Username:   </font>

                      </div></td>

                    <td width="32%"><div align="center"> <b><font size="1">

                        <input name="usuario" type="text" disabled class="botoes" id="usuario" value="<? echo $vars?>" >

                        </font></b> </div></td>

                  </tr>

                </table>

              </div></td>

          <tr>

            <td><table width="65%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="72%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">Nom</font><font color="#FFFFFF" size="1" face="Tahoma">e:   </font>

                    </div></td>

                  <td width="28%"><div align="center"> <b><font size="1">

                      <input name="nome" type="text" class="botoes" value="<? echo $linha["nome"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="65%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="72%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">Apelido:   </font>

                    </div></td>

                  <td width="28%"><div align="center"> <b><font size="1">

                      <input name="apelido" type="text" class="botoes" id="apelido" value="<? echo $linha["apelido"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="65%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="72%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">E-mail</font><font color="#FFFFFF" size="1" face="Tahoma">:   </font>

                    </div></td>

                  <td width="28%"><div align="center"> <b><font size="1">

                      <input name="email" type="text" class="botoes" id="email" value="<? echo $linha["email"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="65%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="72%"><div align="right"> <font color="#FFFFFF" size="1" face="Tahoma">ICQ</font><font color="#FFFFFF" size="1" face="Tahoma">:   </font>

                    </div></td>

                  <td width="28%"><div align="center"> <b><font size="1">

                      <input name="icq" type="text" class="botoes" id="icq" value="<? echo $linha["icq"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="65%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="72%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">Idade:   </font>

                    </div></td>

                  <td width="28%"><div align="center"> <b><font size="1">

                      <input name="idade" type="text" class="botoes" id="idade" value="<? echo $linha["idade"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="65%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="65%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">Data

                      de Nascimento:   </font> </div></td>

                  <td width="35%"><div align="center"> <b><font size="1">

                      <input name="nascimento" type="text" class="botoes" id="nascimento" value="<? echo $linha["nascimento"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="65%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="72%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">Escola:   </font>

                    </div></td>

                  <td width="28%"><div align="center"> <b><font size="1">

                      <input name="escola" type="text" class="botoes" id="escola" value="<? echo $linha["escola"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="65%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="72%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">Mulher

                      Perfeita:   </font> </div></td>

                  <td width="28%"><div align="center"> <b><font size="1">

                      <input name="mulher" type="text" class="botoes" id="mulher" value="<? echo $linha["mulher"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="65%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="72%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">Banda

                      Preferida:   </font> </div></td>

                  <td width="28%"><div align="center"> <b><font size="1">

                      <input name="banda" type="text" class="botoes" id="banda" value="<? echo $linha["banda"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="65%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="72%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">Música

                      Preferida:   </font> </div></td>

                  <td width="28%"><div align="center"> <b><font size="1">

                      <input name="musica" type="text" class="botoes" id="musica" value="<? echo $linha["musica"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="65%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="72%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">DJ</font><font color="#FFFFFF" size="1" face="Tahoma">:   </font>

                    </div></td>

                  <td width="28%"><div align="center"> <b><font size="1">

                      <input name="dj" type="text" class="botoes" id="dj" value="<? echo $linha["dj"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="65%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="72%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">Nike

                      ou All Star ?   </font> </div></td>

                  <td width="28%"><div align="center"> <b><font size="1">

                      <input name="tenis" type="text" class="botoes" id="tenis" value="<? echo $linha["tenis"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="65%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="72%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">Loira

                      ou Morena ?   </font> </div></td>

                  <td width="28%"><div align="center"> <b><font size="1">

                      <input name="loiramorena" type="text" class="botoes" id="loiramorena" value="<? echo $linha["loiramorena"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="65%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="72%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">Ídolo</font><font color="#FFFFFF" size="1" face="Tahoma">:   </font>

                    </div></td>

                  <td width="28%"><div align="center"> <b><font size="1">

                      <input name="idolo" type="text" class="botoes" id="idolo" value="<? echo $linha["idolo"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="86%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="72%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">O

                      copo está metade cheio ou vazio ?   </font>

                    </div></td>

                  <td width="28%"><div align="center"> <b><font size="1">

                      <input name="copo" type="text" class="botoes" id="copo" value="<? echo $linha["copo"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="92%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="74%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">Não

                      pode faltar na sua mala de viagem ?   </font>

                    </div></td>

                  <td width="26%"><div align="center"> <b><font size="1">

                      <input name="viagem" type="text" class="botoes" id="viagem" value="<? echo $linha["viagem"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="65%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="72%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">Carro</font><font color="#FFFFFF" size="1" face="Tahoma">:   </font>

                    </div></td>

                  <td width="28%"><div align="center"> <b><font size="1">

                      <input name="carro" type="text" class="botoes" id="carro" value="<? echo $linha["carro"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="65%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="72%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">Sonho

                      de consumo</font><font color="#FFFFFF" size="1" face="Tahoma">:   </font>

                    </div></td>

                  <td width="28%"><div align="center"> <b><font size="1">

                      <input name="sonho" type="text" class="botoes" id="sonho" value="<? echo $linha["sonho"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="65%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="72%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">Time</font><font color="#FFFFFF" size="1" face="Tahoma">:   </font>

                    </div></td>

                  <td width="28%"><div align="center"> <b><font size="1">

                      <input name="time" type="text" class="botoes" id="time" value="<? echo $linha["time"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="75%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="72%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">É

                      do ZiMM desde quando ?   </font> </div></td>

                  <td width="28%"><div align="center"> <b><font size="1">

                      <input name="desde" type="text" class="botoes" id="desde" value="<? echo $linha["desde"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="77%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="72%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">Mensagem</font><font color="#FFFFFF" size="1" face="Tahoma">

                      para os ZiMMs:   </font> </div></td>

                  <td width="28%"><div align="center"> <b><font size="1">

                      <input name="mensagemzimm" type="text" class="botoes" id="mensagemzimm" value="<? echo $linha["mensagemzimm"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><table width="80%" border="0" align="right" cellpadding="00" cellspacing="00">

                <tr>

                  <td width="72%"><div align="right"><font color="#FFFFFF" size="1" face="Tahoma">Mensagem

                      aos visitantes:   </font> </div></td>

                  <td width="28%"><div align="center"> <b><font size="1">

                      <input name="mensagem" type="text" class="botoes" id="mensagem" value="<? echo $linha["mensagem"];?>">

                      </font></b> </div></td>

                </tr>

              </table></td>

          </tr>

          <tr>

            <td><div align="right">

                <input name="Submit" type="submit" class="botoes" value="Enviar **">

              </div></td>

          </tr>

        </table>

      </form>

     

    </td>

    <td rowspan="2" valign="top"><img src="perfil_r2_c3.gif" name="undefined_2" width="211" height="70" border="0" usemap="#undefined_2Map">

      <img src="perfil_r3_c3.gif" name="undefined_2" width="211" height="141">

    </td>

    <td><img src="spacer.gif" alt="" name="undefined_2" width="1" height="70" border="0"></td>

  </tr>

  <tr>

    <td><img src="spacer.gif" alt="" name="undefined_2" width="1" height="141" border="0"></td>

  </tr>

</table>

</body>

 

</html>

essa é a pagina do formulario:

alterar_db.php

 

<?php

include("conectar.php");

    cabecalho("ZiMM :: AREA DE MANUTENÇÃO","");

$username = $HTTP_SESSION_VARS['username'];

$incluir="update perfil set nome = '$nome' where username = '$username'";

 

    $gravar=mysql_query($incluir) or die ("ops!");

 

 

?>

 

<html>

<link href="../style1.css" rel="stylesheet" type="text/css">

 

<body bgcolor="#333333" text="#FFFFFF">

<div align="center">

  <p><font color="#FFFFFF" size="2" face="Tahoma">Seu perfil foi alterado com sucesso.

    Obrigado pela paciencia !</font></p>

  <p><font color="#FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif"><a href="http://www.polarhome.com/%7Eblogzimm/perfil/ver.php">Para

    ver o seu perfil, clique aqui. **</a><br>

    <a href="http://www.polarhome.com/%7Eblogzimm/perfil/alterar.php">Para atualizar

    algum dado no seu perfil, clique aqui. **</a><br>

    <a href="http://www.polarhome.com/%7Eblogzimm/inicial.php">Para votlar para

    a página inicial da área de manutenção, clique

    aqui **</a></font></p>

  <p> </p>

</div>

</body>

</html>

nota: coloquei para modificar apenas o campo NOME para facilitar, pois são muitos campos e isso pode dexar você que está lendo o codigo confuso =P

 

pow pessoal agradeço MESMO viu ?

valeeeeeeeew

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.