Advertisement
Guest User

Untitled

a guest
Aug 8th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.53 KB | None | 0 0
  1. <?php
  2.  
  3. $server   = '127.0.0.1';
  4. $username = 'root';
  5. $password = '';
  6.  
  7. $dbname   = 'cadastro';
  8.  
  9. $conexao = mysql_connect($server, $username, $password);
  10.            
  11.  
  12. $db = mysql_select_db($dbname);
  13.  
  14.     if(!$conexao):
  15.     exit('conexão falhou: '.  mysql_error());
  16.     endif;
  17.    
  18.     if(!$dbname):
  19.     exit('Falha ao selecionar base de dados: '.  mysql_error());
  20.     endif;
  21.  
  22.     print 'Conexão com MySQL Server: OK <br />';
  23.     print "Definição da base de dados <b>$dbname</b>: OK";
  24.  
  25.  
  26. /*
  27.  * end of file conexao.php
  28.  */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement