PHP PDO return MySQL numbers as strings

Written on Wednesday November 20, 2019 - Permalink - Tags: server, php, mysql


All numbers returned from MySQL database are returned as strings.


Switch from PDO mysql to PDO mysqlnd extension. Depending on OS installed on webserver extensions can have different names but in general mysqlnd is proper extension to use.

GoDaddy for example should use nd_pdo_mysql instead pdo_mysql extension.