Şu şekilde biçimlendirebilir misiniz hocam:
class DB {
function instance() {
self;
self;
return ($pdo == null ? self::init( ) : $pdo);
}
function init() {
self;
PDO;
$pdo = new PDO( 'mysql:host=' . MYSQL_HOST . ';dbname=' . MYSQL_DB, MYSQL_USER, MYSQL_PASS );
self;
self;
$pdo->exec( 'SET NAMES `' . $charset . '`' );
self;
$pdo->setAttribute( ATTR_DEFAULT_FETCH_MODE, FETCH_OBJ );
self;
return $pdo;
}
function query($query, $bindings = null) {
if (is_null( $bindings )) {
self;
self::instance( )->query( $query );
if (!$last_stmt = ) {
return false;
}
}
else {
self;
self:repare( $query );
$last_stmt = ;
self;
if (!$last_stmt->execute( $bindings )) {
return false;
}
}
self;
return $last_stmt;
}
function getVar($query, $bindings = null) {
self::query( $query, $bindings );
if (!$stmt = ) {
return false;
}
return $stmt->fetchColumn( );