Update readme sample (#357)
* Updating readme sample * Update README.md
This commit is contained in:
parent
55d0461bf6
commit
f0fa84dff0
17
README.md
17
README.md
|
@ -296,23 +296,26 @@ Navigate to `/var/www/html` (`/usr/local/var/www/htdocs` on Mac) and create a ne
|
||||||
"PWD" => "yourPassword"
|
"PWD" => "yourPassword"
|
||||||
);
|
);
|
||||||
//Establishes the connection
|
//Establishes the connection
|
||||||
$conn = sqlsrv_connect($serverName, $connectionOptions);
|
$conn = sqlsrv_connect( $serverName, $connectionOptions );
|
||||||
|
if( $conn === false ) {
|
||||||
|
die( FormatErrors( sqlsrv_errors()));
|
||||||
|
}
|
||||||
//Select Query
|
//Select Query
|
||||||
$tsql= "SELECT @@Version as SQL_VERSION";
|
$tsql= "SELECT @@Version as SQL_VERSION";
|
||||||
//Executes the query
|
//Executes the query
|
||||||
$getResults= sqlsrv_query($conn, $tsql);
|
$getResults= sqlsrv_query( $conn, $tsql );
|
||||||
//Error handling
|
//Error handling
|
||||||
|
|
||||||
if ($getResults == FALSE)
|
if ( $getResults == FALSE )
|
||||||
die(FormatErrors(sqlsrv_errors()));
|
die( FormatErrors( sqlsrv_errors()));
|
||||||
?>
|
?>
|
||||||
<h1> Results : </h1>
|
<h1> Results : </h1>
|
||||||
<?php
|
<?php
|
||||||
while ($row = sqlsrv_fetch_array($getResults, SQLSRV_FETCH_ASSOC)) {
|
while ( $row = sqlsrv_fetch_array( $getResults, SQLSRV_FETCH_ASSOC )) {
|
||||||
echo ($row['SQL_VERSION']);
|
echo ( $row['SQL_VERSION']);
|
||||||
echo ("<br/>");
|
echo ("<br/>");
|
||||||
}
|
}
|
||||||
sqlsrv_free_stmt($getResults);
|
sqlsrv_free_stmt( $getResults );
|
||||||
function FormatErrors( $errors )
|
function FormatErrors( $errors )
|
||||||
{
|
{
|
||||||
/* Display errors. */
|
/* Display errors. */
|
||||||
|
|
Loading…
Reference in a new issue