vendredi 29 novembre 2019

PHP Connection Problem with MySQL on localhost

I'm trying to connect to my database on the localhost using wampserver, but I unable to connect to the database my code is::

 public function getConnection(){

        $this->conn = null;

        try{


            $this->conn = new PDO("mysql:host=localhost;dbname=crms", "root", "");
            echo"connect";

        }catch(PDOException $exception){
            echo "Connection error: " . $exception->getMessage();
        }

        return $this->conn;
    }



Aucun commentaire:

Enregistrer un commentaire