有用的PHP数据库类 [英] Useful PHP database class
本文介绍了有用的PHP数据库类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发一个小型的PHP网站。我需要一个易于配置和使用的MySql数据库访问类。
I am working on a small PHP website. I need a MySql database access class that is easy to configure and work with.
不需要是一个完整的框架,我只需要一个最大。几个类。
Does not need to be a full framework, I only need a max. few classes.
推荐答案
ADODb 很容易使用,值得考虑。一些说明性示例:
ADODb is pretty easy to work with and worth considering. Some illustrative samples:
//connect
$dsn = 'mysql://user:pwd@localhost/mydb';
$db = ADONewConnection($dsn);
//get a single value
$value=$db->GetOne("select foo from bar where x=?", array($x));
//get a row
$row=$db->GetRow("select * from bar where x=?", array($x));
//easy insert example
$record=array("id"=>1, "foo"=>"bar");
$db->AutoExecute("table", $record, "INSERT");
这篇关于有用的PHP数据库类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文