Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. /**
  2. @author : Shubham Maurya,
  3. Email id : maurya.shubham5@gmail.com
  4. **/
  5.  
  6. Hi all , Welcome to shubhammaurya.com , Today we are going to discuss ,
  7. How to Call Connect PHP to MSSQL database
  8.  
  9. 1.Make a file in notepad and save it as dbconfig.php and paste the below code.
  10.  
  11. <?php
  12.  
  13. $server_name = "Your server name";
  14. $database_name = "Your database name";
  15. $DB_user = "Your Username";
  16. $DB_pass = "Your Password";
  17.  
  18. try
  19. {
  20. $conn = new PDO("sqlsrv:Server=$server_name;Database=$database_name;ConnectionPooling=0",$DB_user, $DB_pass);
  21. $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  22. echo "done";
  23. }
  24. catch(PDOException $e)
  25. {
  26.  
  27. $e->getMessage();
  28.  
  29. }
  30.  
  31.  
  32. ?>
  33.  
  34. STAY CONNECTED FOR MORE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement