/** * Check for the existence of a table in the currentt database * * @param string $table Name of table to be searched in the database * @param DbConnnect $dbConnect Database connection object * @return string Name of the table checked */ public static function checkTableName($table) { try { $dbConnect = new DBConnect(); $result = $dbConnect->getConnection()->query('SELECT 1 FROM ' . $table . ' LIMIT 1'); if ($result !== false) { return $table; } } catch (PDOException $e) { return $e->getMessage(); } finally { $dbConnect = null; } }
/** * @return object Database connection */ protected function makeDbConn() { $getConn = new DBConnect(); return $getConn->getConnection(); }