-
Notifications
You must be signed in to change notification settings - Fork 374
Closed
Description
When I try to pull data from our database I get shorter strings.
in this example, I use a stored procedure but I try to do select and the results the same
$serverName = "myServer";
$connectionOptions = array(
"Database" => "$dbName",
"UID" => "$dbUser",
"PWD" => "$dbPassword"
);
//Establishes the connection
$conn = sqlsrv_connect($serverName, $connectionOptions);
if ($conn === false) {
die(FormatErrors(sqlsrv_errors()));
}
//Select Query
$tsql = "exec AlumnusDataGet @id = 30000000";
//Executes the query
$getResults = sqlsrv_query($conn, $tsql);
//Error handling
if ($getResults == FALSE)
die(FormatErrors(sqlsrv_errors()));
?>
<h1> Results : </h1>
<?php
while ($row = sqlsrv_fetch_array($getResults, SQLSRV_FETCH_ASSOC)) {
var_dump($row);
echo("<br/>");
}
sqlsrv_free_stmt($getResults);
function FormatErrors($errors)
{
/* Display errors. */
echo "Error information: <br/>";
foreach ($errors as $error) {
echo "SQLSTATE: " . $error['SQLSTATE'] . "<br/>";
echo "Code: " . $error['code'] . "<br/>";
echo "Message: " . $error['message'] . "<br/>";
}
}
The expected output is:
array
'TitleHeb' => 'גב''
'LastNameHeb' => 'אלמן'
'FirstNameHeb' => 'דנה'
'TitleEng' => 'Ms.'
'LastNameEng' => 'Elman'
...
The actual output:
array
'TitleHeb' => 'גב''
'LastNameHeb' => 'אלמ'
'FirstNameHeb' => 'דנ'
'TitleEng' => 'Ms.'
'LastNameEng' => 'Elman'
...
As you can see in the "LastNameHeb" and "FirstNameHeb" the last character is missing.
PHP Version: 7.1.3-3
Tested with both drivers (versions: 4., 5.)
OS: Ubuntu 16.04