Click here for EduSec Demo EduSec Screenshots

Find data from database using findByPk() method in yiiframework

On 2013-06-10 - By Ravi Thanki

Example:
$var = Model name::model()->findByPk(2);
echo $var->name;
?>

Here “2″ is a PK and “Model Name” is a name of model.
when “echo $->any_variable->name” is executed then display name base of pk.

Findall Example

SomeActiveRecord::Model()->findAll(“”);