SHARE
TWEET

Untitled

a guest Aug 12th, 2016 28 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $dsn="mysql:dbname=blog;host=localhost";
  3. $dbuser="root";
  4. $dbpass="";
  5.  
  6. try{
  7.     $pdo =new PDO($dsn,$dbuser,$dbpass);
  8.    
  9.     /*select*/
  10.     $Sql=" SELECT * FROM usuarios ";
  11.     $Sql=$pdo->query($sql);                        //classe metodo pdo
  12.     if($Sql->rowCount()>0){                           //rowcount numero de linhas
  13.        
  14.         echo "possui usuarios";
  15.         }else{
  16.             echo "nao a usuarios cadastrados";
  17.            
  18.            
  19.             }
  20.    
  21.     }catch(PDOException $e){
  22.    
  23.     echo "falhou".$e->getMessage();
  24.    
  25.    
  26.     }
  27.  
  28. ?>
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