Advertisement
Guest User

sadgf

a guest
Oct 23rd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. test
  2. <table>
  3. <?php
  4. $servername = "WIN-TM6CLH242T3\SQLEXPRESS";
  5. $uid = "direktor";
  6. $pwd = '123+"*';
  7. $dbname = "DB-Schule";
  8.  
  9. $connectioninfo = array("Database" => $dbname, "UID" => $uid, "PWD" => $pwd);
  10.  
  11. // Create connection
  12. $conn = sqlsrv_connect($servername, $connectioninfo);
  13.  
  14. if ($conn){
  15. $sql = "SELECT IAM, Vorname FROM dbo.tblStudent";
  16. $stmt = sqlsrv_query( $conn, $sql );
  17. if( $stmt === false) {
  18. die( print_r( sqlsrv_errors(), true) );
  19. }
  20.  
  21. while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
  22. echo $row['IAM'].", ".$row['Name']."<br />";
  23. foreach ($row as $key => $value) {
  24. echo $key.", ".$value."<br>";
  25. }
  26. }
  27.  
  28. sqlsrv_free_stmt( $stmt);
  29.  
  30. }else{
  31. die(print_r(sqlsrv_errors(), true));
  32. }
  33.  
  34.  
  35.  
  36. ?>
  37. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement