CDbException

CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'is ASC LIMIT 1' at line 1. The SQL statement executed was: SELECT * FROM `WEB_images` `t` WHERE id>"3699" AND albumId="365" ORDER BY is ASC LIMIT 1

/home/orguy/public_html/yii/framework/db/ar/CActiveRecord.php(144)

132      */
133     public function __get($name)
134     {
135         if(isset($this->_attributes[$name]))
136             return $this->_attributes[$name];
137         else if(isset($this->getMetaData()->columns[$name]))
138             return null;
139         else if(isset($this->_related[$name]))
140             return $this->_related[$name];
141         else if(isset($this->getMetaData()->relations[$name]))
142             return $this->getRelated($name);
143         else
144             return parent::__get($name);
145     }
146 
147     /**
148      * PHP setter magic method.
149      * This method is overridden so that AR attributes can be accessed like properties.
150      * @param string $name property name
151      * @param mixed $value property value
152      */
153     public function __set($name,$value)
154     {
155         if($this->setAttribute($name,$value)===false)
156         {

Stack Trace

#3
+
 /home/orguy/public_html/web/protected/models/web/WebImage.php(51): CActiveRecord->findAll(array("condition" => "id>"3699" AND albumId="365"", "order" => "is ASC", "limit" => "1"))
46         return $return;
47     }
48 
49     public function getNext() {
50         $image = WebImage::model()->findAll(array('condition'=>'id>"'.$this->id.'" AND albumId="'.$this->albumId.'"', 
51             'order'=>'is ASC', 'limit'=>'1'));
52         $return = count($image)==0?null:$image[0];
53         return $return;
54     }
55 }
#6
+
 /home/orguy/public_html/web/protected/views/webImage/view.php(26): CActiveRecord->__get("next")
21         $prevImage = $model->previous;
22         if(!is_null($prevImage))
23             echo CHtml::link('Anterior', array('webImage/view', 'id'=>$prevImage->id), array('class'=>'btn btn-green pull-left')); 
24     ?>
25     <?php 
26         $nextImage = $model->next;
27         if(!is_null($nextImage))
28             echo CHtml::link('Siguiente', array('webImage/view', 'id'=>$nextImage->id), array('class'=>'btn btn-green pull-right')); ?>
29 </div>
#11
+
 /home/orguy/public_html/web/protected/controllers/WebImageController.php(45): CController->render("view", array("model" => WebImage))
40     public function actionView($id)
41     {
42             $this->layout='//layouts/web/column2';
43             $this->render('view',array(
44                     'model'=>$this->loadModel($id),
45             ));
46     }
47 
48     /**
49      * Returns the data model based on the primary key given in the GET variable.
50      * If the data model is not found, an HTTP exception will be raised.
2024-03-19 04:03:42 Apache Yii Framework/1.1.12