Q&A

매일 today 방문수 초기화 되는 첫 카운트시 에러가 뜹니다.

2020.11.11 15:08
303
0
0
CMS/프레임워크 Rhymix 1.9
개발 언어 PHP 7.2

Query Error: Prepared statement failed: Duplicate entry '0' for key 'PRIMARY' (code -1)
modules/counter/counter.controller.php:66

 

 

    function counterExecute()
    {
        $oDB = DB::getInstance();
        $oDB->begin();

        $site_module_info = Context::get('site_module_info');
        $site_srl = (int) $site_module_info->site_srl;

        // Check the logs
        $oCounterModel = getModel('counter');

        if($oCounterModel->isInsertedTodayStatus($site_srl))
        {
            if($oCounterModel->isLogged($site_srl))
            {
                //  Register pageview
                $this->insertPageView($site_srl);
            }
            else // If unregistered IP
            {
                // Leave logs
                $this->insertLog($site_srl);
                // Register unique and pageview
                $this->insertUniqueVisitor($site_srl);
            }
        }
        else // Register today's row if not exist
        {
            $this->insertTodayStatus(0, $site_srl); // 에러 라인 66번 라인입니다.
            // check user if the previous row exists
        }

        $oDB->commit();
    }

 

저 에러와 만나는 사람은 오늘 방문 카운트 1 인 상태 첫 방문자이고  이후 카운트가 증가되면서 사라집니다.

 

 

https://xe1.xpressengine.com/forum/21352779

 

댓글 0