Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2015
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1. <?php
  2. ini_set('display_startup_errors',1);
  3. ini_set('display_errors',1);
  4. error_reporting(-1);
  5.  
  6. class App
  7. {
  8.     const DB_HOST = '127.0.0.1';
  9.     const DB_USERNAME = 'root';
  10.     const DB_PASSWORD = 'root';
  11.  
  12.     public function run() {
  13.         echo 'Prefix: ' . $this->_getPrefix('ftf');
  14.     }
  15.    
  16.     protected function _getPrefix($dbname) {
  17.         $db = new PDO("mysql:host=".SELF::DB_HOST.";dbname=$dbname",SELF::DB_USERNAME,SELF::DB_PASSWORD);
  18.         $sql = 'SHOW tables like :config';
  19.         $q = $db->prepare($sql);
  20.         $q->bindValue(':config', '%core_config_data%');
  21.         $q->execute();
  22.         $data = $q->fetchAll();
  23.         $data = explode("core_config_data", $data[0][0]);
  24.    
  25.         return $data[0];
  26.     }
  27. }
  28.  
  29. $app = new App();
  30. $app->run();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement