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 'order by featuredPost='Yes' desc, id asc LIMIT 0, 30' at line 1. The SQL statement executed was: select * from florida_keys_property_listing where listingstatus='Approve' and catId= order by featuredPost='Yes' desc, id asc LIMIT 0, 30

/home/visitfloridakeys/public_html/yii/framework/db/CDbCommand.php(528)

516             return $result;
517         }
518         catch(Exception $e)
519         {
520             if($this->_connection->enableProfiling)
521                 Yii::endProfile('system.db.CDbCommand.query('.$this->getText().$par.')','system.db.CDbCommand.query');
522             $errorInfo = $e instanceof PDOException ? $e->errorInfo : null;
523             $message = $e->getMessage();
524             Yii::log(Yii::t('yii','CDbCommand::{method}() failed: {error}. The SQL statement executed was: {sql}.',
525                 array('{method}'=>$method, '{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
526             if(YII_DEBUG)
527                 $message .= '. The SQL statement executed was: '.$this->getText().$par;
528             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
529                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
530         }
531     }
532 
533     /**
534      * Builds a SQL SELECT statement from the given query specification.
535      * @param array $query the query specification in name-value pairs. The following
536      * query options are supported: {@link select}, {@link distinct}, {@link from},
537      * {@link where}, {@link join}, {@link group}, {@link having}, {@link order},
538      * {@link limit}, {@link offset} and {@link union}.
539      * @return string the SQL statement
540      * @since 1.1.6

Stack Trace

#1
+
 /home/visitfloridakeys/public_html/protected/controllers/SiteController.php(1356): CDbCommand->queryAll()
1351 
1352         if(isset($_GET['scid'])){
1353             $scid = " and FIND_IN_SET(".$_GET['scid'].", subcatId) > 0 ";
1354         }else{$scid = '';}
1355         $matching ="select * from  florida_keys_property_listing where listingstatus='Approve' and catId=".$_GET['cid']." ".$scid." order by featuredPost='Yes' desc, id asc LIMIT $start, $limit ";
1356         $mtchdata=Yii::app()->db->createCommand($matching)->queryAll();
1357         
1358         //$matching_featured ="select * from  florida_keys_property_listing where listingstatus='Approve' and featuredPost='Yes' and catId=".$_GET['cid']." ".$scid." LIMIT $start, $limit ";
1359         //$mtchdata_featured=Yii::app()->db->createCommand($matching_featured)->queryAll();
1360         
1361         
#14
+
 /home/visitfloridakeys/public_html/index.php(13): CApplication->run()
08 defined('YII_DEBUG') or define('YII_DEBUG',true);
09 // specify how many levels of call stack should be shown in each log message
10 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
11 
12 require_once($yii);
13 Yii::createWebApplication($config)->run();
2024-03-19 07:25:22 Apache Yii Framework/1.1.11