douhuang5623 2010-06-30 11:58
浏览 14
已采纳

将多个dbms查询响应转换为相同类型的变量(PHP)

I am making a function (PHP). In this function it basically uses the dbms specified and connects, submits the appropriate query, <insert my problem here>, and disconnects. DBMSs include MySQL, MSSQL, Postgres, and Oracle.

I am assuming that outside of this function, the user would not have access to specified DMBS, so whatever results I get from it I need to convert to something usable like a regular PHP variable/array/object.

I don't know the best way to do this (and have only had extended experience with MySQL), so I would like to know how going about handling each return so that they all come out to PHP relatively the same. I would extremely appreciate an example in any case.

  • 写回答

1条回答 默认 最新

  • dqysi86208 2010-06-30 12:02
    关注

    Unless you are doing this to learn, I recommend looking into PDO. It comes built in since PHP 5, and can handle the DBMSs you mention.

    There's also ADODb that supports even more DBMSs but has the disadvantage of not being a native, compiled part of PHP.

    In my opinion, it's not worth writing an own database wrapper anymore in 2010 for production use. There are too many high-quality industry-standard solutions around.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 iqoo11 如何下载安装工程模式
  • ¥15 flask项目,怎么使用AJAX传数据库数据到echarts图表的data里,实现异步加载数据。
  • ¥15 本题的答案是不是有问题
  • ¥15 关于#r语言#的问题:(svydesign)为什么在一个大的数据集中抽取了一个小数据集
  • ¥15 C++使用Gunplot
  • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?
  • ¥15 蓝桥杯单片机第十三届第一场,整点继电器吸合,5s后断开出现了问题