/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Encuestas::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'La página solicitada no existe.'); } return $model; }
<td width="10%" > <div style="position: absolute; top: 182px;"> <?php for ($i = 0; $i < 5; $i++) { $numero_aleatorio = rand(1, 500); $publicidades = Publicidades::model()->findAll("`idPublicidad` = {$numero_aleatorio}"); if ($publicidades == Null) { $i--; } else { foreach ($publicidades as $data) { if ($i == 2) { ?> <div style="position: static; margin-top: 5px; background-color: white"> <p> <?php $encuesta = Encuestas::model()->findAll(array('order' => 'idEncuesta DESC', 'limit' => 1)); foreach ($encuesta as $dataE) { echo $dataE->pregunta; $_SESSION['idEncuesta'] = $dataE->idEncuesta; $opciones = Opciones::model()->findAll(array('order' => 'idOpcion DESC', 'condition' => "`encuestas_idEncuesta` = {$dataE->idEncuesta}")); ?> <ul><?php foreach ($opciones as $dataO) { ?> <li><?php echo $dataO->opcion; if (!isset($_SESSION)) { session_start(); } else { if (!isset($_SESSION['vot'])) { $_SESSION['vot'] = 0;