Useful PHP database class

前端 未结 11 1191
生来不讨喜
生来不讨喜 2021-02-06 06:21

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

相关标签:
11条回答
  • 2021-02-06 06:44

    Also digg's PDB, which is a simple PDO wrapper or something can be downloaded from http://code.google.com/p/digg/wiki/PDB

    0 讨论(0)
  • 2021-02-06 06:47

    You can try Zend_Db from Zend Framework. Later you may include mode components from ZF.

    0 讨论(0)
  • 2021-02-06 06:51

    I think PEAR::MDB2 is what you are looking for.

    0 讨论(0)
  • 2021-02-06 06:56

    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;
        ?>
    
    0 讨论(0)
  • 2021-02-06 06:59

    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.

    0 讨论(0)
  • 2021-02-06 07:01

    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.

    0 讨论(0)
提交回复
热议问题