What's wrong with this?

VaginaMuncher

Chilling with me bitch Fiona
Mar 17, 2013
447
58
Basically I'm just testing database connections
"echo 'Connected';" yet nothing comes out..

I'm new to this PHP/PDO coding etc. Don't see what's wrong S:

Code:
<?php
class DB{
    private static $_instance = null;
    private $_pdo,
            $_query,
            $_error = false,
            $_results,
            $_count = 0;

    private function __construct() {
        try {
            $this->_pdo = new PDO('mysql:host=' . Config::get('mysql/host') . ';dbname=' . Config::get('mysql/db'), Config::get('mysql/username'), Config::get('mysql/password'));
        echo 'Connected';
        } catch(PDOException $e)
            die($e->getMessage());
        }
    }

    public static function getInstance();{
        if(!isset(self::$_instance)) {
            self::$_instance = new DB();

        }

        return self::$_instance;

    }
}
?>
 

Hindi

System.out.println(" ");
Dec 30, 2012
989
193
Basically I'm just testing database connections
"echo 'Connected';" yet nothing comes out..

I'm new to this PHP/PDO coding etc. Don't see what's wrong S:

Code:
<?php
class DB{
    private static $_instance = null;
    private $_pdo,
            $_query,
            $_error = false,
            $_results,
            $_count = 0;

    private function __construct() {
        try {
            $this->_pdo = new PDO('mysql:host=' . Config::get('mysql/host') . ';dbname=' . Config::get('mysql/db'), Config::get('mysql/username'), Config::get('mysql/password'));
        echo 'Connected';
        } catch(PDOException $e)
            die($e->getMessage());
        }
    }

    public static function getInstance();{
        if(!isset(self::$_instance)) {
            self::$_instance = new DB();

        }

        return self::$_instance;

    }
}
?>
There's nothing wrong with this IMO? Never done PDO But I can understand since similar code to java (not literally but yeah )
Nevertheless, You've just added the " echo 'Connected'; "
So it just echo's Connected stating that your database is connected..
Add some more codes within 'try' block to see it executed ~_~
 

VaginaMuncher

Chilling with me bitch Fiona
Mar 17, 2013
447
58
There's nothing wrong with this IMO? Never done PDO But I can understand since similar code to java (not literally but yeah )
Nevertheless, You've just added the " echo 'Connected'; "
So it just echo's Connected stating that your database is connected..
Add some more codes within 'try' block to see it executed ~_~
Yeah it's PDO. Kinda gave up on it. Couldn't fix my errors aha cheers anyway :3
 

Users who are viewing this thread

Top