Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. <?php
  2.    
  3. if(isset($_POST['nome'] && empty($_POST['nome'] == false){
  4.  
  5.     $nome = addslaches($_POST['nome']);
  6.     $descricoes = addslaches($_POST['descricoes']);
  7.     $entrada = addslaches($_POST['entrada']);
  8.     $saida = addslaches($_POST['saida']);
  9.  
  10.     $sql = "INSERT INTO anotacoes 'nome, descricoes, entrada, saida, data' VALUES '".$nome."', '".$descricoes."', '".$entrada."', '".$saida."', NOW()";
  11.     $sql = pdo->query($sql);
  12.    
  13.     echo "<script> window.alert("INSERIDO COM SUCESSO !");</script> ";
  14.  
  15.  
  16. }
  17.  
  18. ?>
  19.  
  20.  
  21. CONEXÃO BANCO DE DADOS.
  22.  
  23. <?php
  24. $dsn = "mysql:dbname=NOMEDOBANCODEDADOS;host=localhost";
  25. $dbuser = 'root';
  26. $dbpass = '';
  27.  
  28. try{
  29.     $pdo = new PDO($dsn, $dbuser, $dbpass);
  30.  
  31. } catch (PDOException $e){
  32.     echo "Falhou a conexao:".$e->getMessage();
  33. }
  34. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement