Advertisement
Guest User

Untitled

a guest
Jan 2nd, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. <?php
  2.  
  3. $server = 'localhost';
  4. $port = '1443'; // porta
  5. $server = $port !== '1443' && is_string($port) ? $server .= ", $port": $server;
  6. $database = 'teste'; // Base de dados
  7. $user = 'User'; // User
  8. $pass = '123456'; // Pass
  9.  
  10. $conn = sqlsrv_connect($server, array('Database' => $database, 'UID' => $user, 'PWD' => $pass));
  11.  
  12. if($conn)
  13. {
  14. // Sucesso ao se conectar
  15. }
  16. else
  17. {
  18. // Falha ao se conectar
  19. echo "A conexão foi estabelecida.<br/>";
  20. die(print_r(sqlsrv_errors(), true));
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement