Error When Use Find Method.

Hello,

i have Cursos.php, Grupovalores.php and Grupovaloresdetalle.php

In the class Cursos.php i have then traerDescripcionTipoCurso method, this method produce an error when:

public function traerDescripcionTipoCurso()

{

(1)$IdGrupo = Grupovalores::model()->find(array(‘condition’=>“Codigo_ID_Grupo=‘TIPO_CURSO’”))->idGrupoValores;

(2)$criterio = new CDbCriteria();

(3)$criterio->condition = ‘idGrupoValores=:idGrupoValores and idGrupoValoresDetalle=:idGrupoValoresDetalle’;

(4)$criterio->params = array(’:idGrupoValores’=>$IdGrupo, ‘:idGrupoValoresDetalle’=>$this->IdTipoCurso);

(5)$model = Grupovaloresdetalle::model()->find($criterio);

(6)return $model->NomValor;

}

lines between 1 and 4 it’s OK but the 5 line produce an error, i can’t see this error, i see error 500.

i use:

  • operating system : Windows vista

  • Web server : IIS

  • browser type : Chrome

  • Yii version : Yii 1.1.14

Enable DEBUG in index.php to see the full error stack. The error 500 should at least mention something, though if you are making an AJAX request it can be hard to see unless you print the response data error.

Also, you can use code tags in your post to place your code in.

Hi ASPtoYiiDev.

In my index.php i have the follow lines:

defined(‘YII_DEBUG’) or define(‘YII_DEBUG’,true);

defined(‘YII_TRACE_LEVEL’) or define(‘YII_TRACE_LEVEL’,3);

but the error the error occurs in the five line:

public function traerDescripcionTipoCurso()

{

(1)$IdGrupo = Grupovalores::model()->find(array(‘condition’=>“Codigo_ID_Grupo=‘TIPO_CURSO’”))->idGrupoValores;

(2)$criterio = new CDbCriteria();

(3)$criterio->condition = ‘idGrupoValores=:idGrupoValores and idGrupoValoresDetalle=:idGrupoValoresDetalle’;

(4)$criterio->params = array(’:idGrupoValores’=>$IdGrupo, ‘:idGrupoValoresDetalle’=>$this->IdTipoCurso);

(5)$model = Grupovaloresdetalle::model()->find($criterio);

(6)return $model->NomValor;

}

Finally I found the error. I had an error in my class. Thanks