Selecting number from SQL Server adds .0

Viewed 47

When I select a column in SQL Server and then print it, 3 becomes 3.0.

This is my connection:

$sql = new PDO("sqlsrv:Driver=$driver;server=$server,$port;Database=$database;ConnectionPooling=0", $uid, $pwd,
        array(
            PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
        )
    );

This is my SELECT:

$sth = $sql->prepare("SELECT column FROM table
                      WHERE column2 = :value2");
    
$params = array(':value2' => $_POST['value2']);
    
$sth->execute($params);
$result = $sth->fetchAll(\PDO::FETCH_ASSOC);
   
echo json_encode($result);
  • In SQL Server database: 3
  • In echo: 3.0

What can be the reason for adding .0?

0 Answers
Related