Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Sql Statement

$
0
0
I have the action in the main controller:
public function actionIndex()
	{	
		$criteria = new CDbCriteria();
		$criteria->condition = 'carousel == 1';
		$carousel = Cars::model()->findAll($criteria);

		$this->render('index', array(
			'carousel' => $carousel,
			));
	}

on the condition i have the mistake:

Quote

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 '== 1' at line 1. The SQL statement executed was: SELECT * FROM `primauto_cars` `t` WHERE carousel == 1

what is wrong and how to resolve this problem.
P.S. i am newbie in YII

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>