我无法连接到mysql?

时间:2017-06-06 05:23:37

标签: php phpmyadmin

here is my code please help me to solve this prob.i think error is inside the function. compiler show error on line 9. thanks in advance

<?php

class db_connector{
var $db_dsn="mysql:host=localhost;dbname=erp5_temp2";
var $db_username = "root";
var $db_password = "";
var $dbh ="";

    public db_connector(){  
        $dbh = new PDO($this->$db_dsn,$this->$db_username,$this->$db_password);
        $dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES,TRUE);
    }
    public get_db_handler(){
        return $dbh;
    }
}

&GT;

2 个答案:

答案 0 :(得分:0)

您忘记了function关键字:

class ClassName
{
    public function methodName()
    {
        // ...
    }
}

答案 1 :(得分:0)

您需要 select Max(cast(date as Date)) , CUSTOMER, LOCATION from table GROUP BY CUSTOMER , LOCATION 声明:

function