Try changing
class connection {
protected $db_connect;
public $db_username = 'root';
public $db_hostname = 'localhost';
public $db_database = 'test';
public $db_password = '';
to
class connection {
protected $db_connect;
public $db_username = "root";
public $db_hostname = "localhost";
public $db_database = "test";
public $db_password = "";
Also, I usually work via DAO
class DAO {
private static $dbHost = "localhost";
private static $dbName = "kcart";
private static $dbUser = "kcartTest";
private static $dbPass = "";
private static $sharedPDO;
protected $pdo;
function __construct() {
if(empty(self::$sharedPDO)) {
self::$sharedPDO = new PDO("mysql:host=" . self::$dbHost . ";dbname=" . self::$dbName, self::$dbUser, self::$dbPass);
self::$sharedPDO->exec("SET CHARACTER SET utf8");
self::$sharedPDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
self::$sharedPDO->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
}
$this->pdo =& self::$sharedPDO;
}