Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The best database class or functions for PHP? [closed]

I'm going to start to write a new software with PHP, and I need to know the best way to use database. Should I choose a database class such as Adodb, ezSql etc.

What do you think which class is the best one?

like image 541
kuzey beytar Avatar asked Dec 17 '22 21:12

kuzey beytar


2 Answers

It depends if you need an ORM, or just a database abstraction layer. If you're using Zend Framework then Zend_Db is a great choice. Propel ORM is a great ORM for PHP. Doctrine is another great ORM library. On the other hand if you only need an abstraction layer, consider using the built-in PDO, or libraries like PEAR MDB2.

like image 97
racetrack Avatar answered Jan 02 '23 09:01

racetrack


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;
?>
like image 30
Edmhs Avatar answered Jan 02 '23 10:01

Edmhs