SHARE
TWEET

Untitled

a guest Aug 12th, 2016 97 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. //fazendo um update no banco de dados,alterando dados de clientes em tabelas
  3.  
  4. $dsn="mysql:dbname=blog;host=localhost";//variaveis de conexao
  5. $dbuser="root";
  6. $dbpass="";
  7.  
  8. try{
  9.     $pdo=new PDO($dsn,$dbuser,$dbpass);
  10.     //query de update
  11.     $sql="UPDATE usuarios SET email='jose@jose.com' WHERE email='jose@hotmail.com'";
  12.     $sql=$pdo->query($sql);
  13.    
  14.     echo "Usuario Alterado com Sucesso";
  15.     }catch(PDOEcception $e){
  16.  echo "falhou".$e->getMessage();   
  17.    
  18.     }
  19.  
  20. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top