PHP code example of wattanar / sqlsrv-helper

1. Go to this page and download the library: Download wattanar/sqlsrv-helper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wattanar / sqlsrv-helper example snippets




use Wattanar\SqlsrvHelper;

$conn = sqlsrv_connect(/* your connection here */);

// get single row from query
$row = (new SqlsrvHelper)->getRow(sqlsrv_query(
  $conn,
  "SELECT * FROM Users"
));

// print result
echo "</pre>" . print_r($row, true) . "</pre>";

// get rows from query
$rows = (new SqlsrvHelper)->getRows(sqlsrv_query(
  $conn,
  "SELECT * FROM Users"
));

// print result
echo "</pre>" . print_r($rows, true) . "</pre>";