From f0fa84dff0a9b05fa78b868a747244c71adaf72d Mon Sep 17 00:00:00 2001 From: ulvii Date: Mon, 3 Apr 2017 12:21:38 -0700 Subject: [PATCH] Update readme sample (#357) * Updating readme sample * Update README.md --- README.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 84bb38a0..b27347a1 100644 --- a/README.md +++ b/README.md @@ -296,23 +296,26 @@ Navigate to `/var/www/html` (`/usr/local/var/www/htdocs` on Mac) and create a ne "PWD" => "yourPassword" ); //Establishes the connection - $conn = sqlsrv_connect($serverName, $connectionOptions); + $conn = sqlsrv_connect( $serverName, $connectionOptions ); + if( $conn === false ) { + die( FormatErrors( sqlsrv_errors())); + } //Select Query $tsql= "SELECT @@Version as SQL_VERSION"; //Executes the query - $getResults= sqlsrv_query($conn, $tsql); + $getResults= sqlsrv_query( $conn, $tsql ); //Error handling - if ($getResults == FALSE) - die(FormatErrors(sqlsrv_errors())); + if ( $getResults == FALSE ) + die( FormatErrors( sqlsrv_errors())); ?>

Results :

"); } - sqlsrv_free_stmt($getResults); + sqlsrv_free_stmt( $getResults ); function FormatErrors( $errors ) { /* Display errors. */