Ir para conteúdo
Fórum Script Brasil

William Lima

Membros
  • Total de itens

    2
  • Registro em

  • Última visita

Sobre William Lima

  • Data de Nascimento 24/05/1994

Contatos

  • Website URL
    http://uipi.pagodabox.com

Perfil

  • Gender
    Male

William Lima's Achievements

0

Reputação

  1. Isso!! Falta de atenção minha xD! Obrigado! Tópico resolvido!
  2. E aí galera, estou aprendendo php/mysql e estou tendo alguns problemas... A variável $lname recebe o valor da variável $bdate... Fiz um formulário que é o seguinte? <htlm> <header> <title>Cadastre-se!</title> </header> <body> <form method="post" action="teste.php"/> First Name <input type="text" name="firstname"/> <br /> Last Name <input type="text" name="lastname"/> <br /> Phone <input type="number" name="phone"/> <br /> Birth Date <input type="date" name="lastname"/> <br /> <input type="submit"> </form> </body> </html> e quando confirma ele vai para esse documento que pega as vars via $_POST, mas ocorre aquele erro da troca de valores e no banco de dados não envia a var $bdate e a var $lname fica com o valor da var $bdate. Código do documento enviado. <html> <head> <title>Inserindo dados em um Banco de Dados</title> </head> <body> <?php // Conexão com o Banco de Dados mysql_connect("localhost", "*****", "*****") or die (mysql_error ()); // Seleciona o Banco de Dados mysql_select_db("mydatabase") or die(mysql_error()); // Comando SQL $fname = $_POST["firstname"]; $lname = $_POST["lastname"]; $phone = $_POST["phone"]; $bdate = $_POST["birthdate"]; $strSQL = "INSERT INTO people("; $strSQL = $strSQL . "firstname, "; $strSQL = $strSQL . "lastname, "; $strSQL = $strSQL . "phone, "; $strSQL = $strSQL . "birthdate) "; $strSQL = $strSQL . "VALUES("; $strSQL = $strSQL . "'" .$fname . "', "; $strSQL = $strSQL . "'" .$lname . "', "; $strSQL = $strSQL . "'" .$phone . "', "; $strSQL = $strSQL . "'" .$bdate . "')"; // Comando SQL executado mysql_query($strSQL) or die (mysql_error()); // Encerra conexão mysql_close(); ?> <h1> Banco de Dados atualizado!<br /> Bem Vindo <?php echo $fname . " " .$lname ?> </h1> </body> </html> Se possível, me ajudem! Abraço :ninja:
×
×
  • Criar Novo...