Не нравятся результаты поиска? Попробуйте другой поиск!
DLE FAQ » Все вопросы » Общие вопросы по PHP » Как избавиться от MySQL ошибки?

Как избавиться от MySQL ошибки?


     05.06.2015    Все вопросы » Общие вопросы по PHP    2673

вопрос
Приветствую, в последнее время стала часто появляться MySQL ошибка
Error Number: 2006
The Error returned was:
MySQL server has gone away
Как избавиться от MySQL ошибки?


вот строка 1117 из functions.php
$sql_result = $db->query( $sql_select );

Вот часть кода в котором находится эта строка:
if( $content !== false ) {
        $config['allow_cache'] = $allow_cache;
        $custom_news = true;
        return $content;
    } else {

        if ( $build_navigation ) {

            $count_all = $db->super_query( "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE ".implode(' AND ', $where) );
            $count_all = $count_all['count'] - $custom_all;

        }

        $tpl = new dle_template();
        $tpl->dir = TEMPLATE_DIR;                

        $tpl->load_template( $custom_template . '.tpl' );

        $sql_select .= " WHERE ".implode(' AND ', $where)." ORDER BY " . $fixed . $news_sort . " " . $news_msort . " LIMIT " . $custom_from . "," . $custom_limit;
        $sql_result = $db->query( $sql_select );
        
        include (ENGINE_DIR . '/modules/show.custom.php');
        
        if( $config['files_allow'] ) if( strpos( $tpl->result['content'], "[attachment=" ) !== false ) {
            $tpl->result['content'] = show_attach( $tpl->result['content'], $attachments );
        }
        
        if ( $custom_news ) create_cache( "news", $tpl->result['content'], $custom_cache_id, true );
        $config['allow_cache'] = $allow_cache;
        return $tpl->result['content'];
    
    }

Как избавиться от этой ошибки?

Ответил: ПафНутиЙ


Меняйте хостинг, или оптимизируйте mysql.

2 комментария

follor
Юзер

follor - 7 июня 2015 19:16 -

Так а что не так с запросом этим, что оптимизировать?

Чтобы комментировать - войдите или зарегистрируйтесь на сайте

Похожие вопросы

наверх