pg_query结果包含字符串,而不是整数,数字 [英] pg_query result contains strings instead of integer, numeric

查看:154
本文介绍了pg_query结果包含字符串,而不是整数,数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用pg_query,pg_fetch_assoc从PostgreSQL数据库中获取数据时,所有数字字段都以字符串形式返回.有没有解决的办法,还是我必须按照自己的方式对每个字段进行类型转换?

When I get data from a postgresql database with pg_query,pg_fetch_assoc all numeric fields get returned as strings. Is there a way around this or do I have to typecast every single field the way I need it to be?

推荐答案

PHP就是这样做的.从手册:

That's what PHP does. From the manual:

数组中的每个值都表示为一个字符串.

Each value in the array is represented as a string.

这篇关于pg_query结果包含字符串,而不是整数,数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆