after login to my page www.skym.sk I get an error NetworkError: 500 Internal Server Error. Interesting is that this error is not show everytime and also when I tried
defined('YII_DEBUG') or define('YII_DEBUG',true);
there is no error.
Can it be problem with memory limits?
Thank you… I am in production mode so thanks for every fast comment.
The 500 error is a bit cryptic as there are different things that could lead to it… your best bet would be to check the webserver log to get more info about the reason for it.
not happend when I put there error_reporting(0)… still just white screen… After I delete one(doesn’t matter which) div with component from view it working again…
My webhosting provider increase my memory limit and also post limit… Where can be problem?
While I am rewriting I remember why I use CArrayDataProvider except of CActiveDataProvider.
I use group by in my CDbCriteria and then there is problem with paginations - CActiveDataProvider get all records in pager…
So what I did?
$criteria = new CDbCriteria();
$criteria->select="encountering_id, encountered_id, count(encountering_id) AS number, max(t.added_on) AS last_added_on, (CASE WHEN is_seen=0 THEN 0 ELSE 1 END) as seen";
$criteria->condition = 'encountered_id = :encounteredId';
$criteria->addCondition('t.vote = :voteYes');
$criteria->group="encountering_id";
$criteria->order = 'last_added_on DESC, number DESC';
$criteria->params = array('encounteredId' => Yii::app()->user->id, 'voteYes'=> self::VOTE_YES);
$dataprovider=new CActiveDataProvider('Encounter', array('criteria' => $criteria,'pagination'=>array(
'pageSize'=>8,
),)
);
$criteriaCount = new CDbCriteria();
$criteriaCount->select="count(DISTINCT t.encountering_id)";
//$criteriaCount->distinct=true;
$criteriaCount->condition = 't.encountered_id = :encounteredId';
$criteriaCount->addCondition('t.vote = :voteYes');
$criteriaCount->params = array('encounteredId' => Yii::app()->user->id, 'voteYes'=> self::VOTE_YES);
$dataprovider->setTotalItemCount($this->resetScope()->count($criteriaCount));
return $dataprovider;
maybe this will help somebody.
Some comments to code:
//$criteriaCount->distinct=true; this is commented because when I use
$criteriaCount->select="t.encountering_id";
$criteriaCount->distinct=true;
SQL is:
SELECT COUNT(DISTINCT `t`.id) FROM `encounter` `t` WHERE (t.encountered_id = :encounteredId) AND (t.vote = :voteYes)
when
$criteriaCount->select="(DISTINCT t.encountering_id)";
//$criteriaCount->distinct=true; COMMENTED
SQL is:
SELECT COUNT(*) FROM `encounter` `t` WHERE (t.encountered_id = :encounteredId) AND (t.vote = :voteYes)
and without any clever reason what I want is
$criteriaCount->select="count(DISTINCT t.encountering_id)";
//$criteriaCount->distinct=true; COMMENTED
SQL is:
SELECT count(DISTINCT t.encountering_id) FROM `encounter` `t` WHERE (t.encountered_id = :encounteredId) AND (t.vote = :voteYes)