如何扩展mysqli它是无声的,就像用@调用一样

时间:2017-12-12 14:07:51

标签: php mysql mysqli

我的班级第一名:

public <T> void putList(String key, List<T> lst){
    for(T object : lst){
         if(object instanceof String) {
             doSomething(((String)object).doForString())
         }
         if(object instanceof Integer) {
             doSomething(((Integer)object).doForInteger())
         }
    }
}

在这里,我将收到此错误消息:

    class database extends mysqli {
    public function __construct($dbInfo) {
            parent::__construct($dbInfo['host'], $dbInfo['user'], $dbInfo['pass'], $dbInfo['dbname']);

            if (mysqli_connect_error()) {
                die('Connect Error (' . mysqli_connect_errno() . ') '
                        . mysqli_connect_error());
            }
            $this->set_charset("utf8");
        }
    }

        $dbInfo = array(
            'host'      => "localhost",
            'user'      => "user",
            'pass'      => "pass",
            'dbname'    => "name"
        );



$db = new database($dbInfo);

我想只将此作为错误:

<br />
<b>Warning</b>:  mysqli::mysqli(): (HY000/1044): Access denied for user 'user'@'%' to database 'name' in <b>/www/test/ajax_artikellist.php</b> on line <b>16</b><br />
Connect Error (1044) Access denied for user 'user'@'%' to database 'name'

我必须做些什么来获得它?

0 个答案:

没有答案