Getting Cdbexception

i have sql query which is working fine in my core php project. but in yii i am trying to execute same query in controller. but i am getting this error.

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 ‘‘2013-09-10’)’ at line 1. The SQL statement executed was: insert into members_95 (exercise_type,exercise,reps,date) values (‘Circuit’,’’,‘2013-09-10’)

i don’t know why yii generating Exception for this? :blink:

Hi please check your query

I think you can insert the 4 value and in your query you can write the insert query only 3 values

so please change this


 values ('Circuit','',,'2013-09-10')

to


insert into members_95 (exercise_type,exercise,reps,date) values ('Circuit','','[b]aaaaa[/b]','2013-09-10')

i think it’s solved

thanks Maggie Q,

it’s works like charm…

i just changed my db structure for 3rd field to varchar instead of int. so it will take null value by default.

and it worked… ::)

cheers ::)