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.
PDO works great for me, even tho it's not a fully blown library like PEAR::MDB2.
PDO is a compiled extension of PHP5, so there's a small performance benefit as well.
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");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With