Advertisement
Guest User

example2

a guest
Mar 17th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. header ("Content-Type: text/html; charset=utf-8");
  2.  
  3. $myServer = "localhost";
  4. $myUser = "test";
  5. $myPass = "00umonot";
  6. $myDB = "Актёры";
  7. $connectionInfo = array("Database"=>$myDB, "UID" => $myUser, "PWD" => $myPass, "CharacterSet" => "UTF-8");
  8.  
  9. $conn = sqlsrv_connect($myServer, $connectionInfo); //returns false
  10.  
  11. if( $conn ) {
  12.     echo "Connection established.<br />";
  13.  
  14. }else{
  15.     echo "Connection could not be established.<br />";
  16.     die( print_r( sqlsrv_errors(), true));
  17. }
  18.  
  19. $stmt = sqlsrv_query($conn,"SELECT * FROM actors ");
  20.  
  21. if( $stmt === false) {
  22.     die( print_r( sqlsrv_errors(), true) );
  23. }
  24.  
  25.  
  26.  
  27. while ($row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC))
  28. {
  29.     echo $row['ФИО'].'<br>';
  30. }
  31.  
  32. sqlsrv_free_stmt( $stmt);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement