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 ma
Also digg's PDB, which is a simple PDO wrapper or something can be downloaded from http://code.google.com/p/digg/wiki/PDB
You can try Zend_Db from Zend Framework. Later you may include mode components from ZF.
I think PEAR::MDB2 is what you are looking for.
The simplest and lightweight db class is
http://code.google.com/p/edb-php-class/
<?php
$result = $db->q("select * from `users`limit 3");
foreach($result as $a){
$a = (object) $a;
echo $a->id.' '.$a->name.' '.$a->url.' '.$a->img.'</br>';
}
$result = $db->line("select * from `users` where id = '300' limit 1");
echo $result['name'];
echo $result['surname'];
$name = $db->one("select name from `ilike_pics` where id = '300' limit 1");
echo $name;
?>
I recommend to use PHP-MySQLi-Database-Class, which utilizes MySQLi and prepared statements (this means that you will be protected from SQL injection). Class is well documented.
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.