public static function swapTable($tbl): string
    {
        $tmp_tbl = $tbl . '_' . NOW;
        $new_tbl = $tmp_tbl . '_new';

        self::getInstance()->sql_query(str_replace('`' . $tbl . '`', '`' . $new_tbl . '`', self::getCreateTable($tbl)));
        self::getInstance()->sql_query('RENAME TABLE `' . $tbl . '` TO `' . $tmp_tbl . '`, `' . $new_tbl . '` TO `' . $tbl . '`');

        return $tmp_tbl;
    }
public static function swapTable($tbl): string
    {
        $tmp_tbl = $tbl . '_' . NOW;
        $new_tbl = $tmp_tbl . '_new';

        self::getInstance()->sql_query(str_replace('`' . $tbl . '`', '`' . $new_tbl . '`', self::getCreateTable($tbl)));
        self::getInstance()->sql_query('RENAME TABLE `' . $tbl . '` TO `' . $tmp_tbl . '`, `' . $new_tbl . '` TO `' . $tbl . '`');

        return $tmp_tbl;
    }
public static function swapTable ( $ tbl ) : string { $ tmp_tbl = $ tbl . '_' . NOW ; $ new_tbl = $ tmp_tbl . '_new' ; self :: getInstance ( ) -> sql_query ( str_replace ( '`' . $ tbl . '`' , '`' . $ new_tbl . '`' , self :: getCreateTable ( $ tbl ) ) ) ; self :: getInstance ( ) -> sql_query ( 'RENAME TABLE `' . $ tbl . '` TO `' . $ tmp_tbl . '`, `' . $ new_tbl . '` TO `' . $ tbl . '`' ) ; return $ tmp_tbl ; }
Create new empty table with same name and save old with content with unique name
Useful saving logs and achieving

@param string $tbl
@return string
Create new empty table with same name and save old with content with unique name Useful saving logs and achieving