I am using yii poll extension. I copied the sql file into my db. It works fine untill i vote. But when i click on vote it shows command error.
ie:-
CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (database
.poll_vote
, CONSTRAINT vote_user
FOREIGN KEY (user_id
) REFERENCES users
(uid
) ON DELETE CASCADE ON UPDATE CASCADE). The SQL statement executed was: INSERT INTO poll_vote
(user_id
, ip_address
, timestamp
, choice_id
, poll_id
) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4);
I havent implemented this part of document. 1. Setup a User active record with an integer ID returned by Yii::app()->user->id.*
Can anyone help wt does that mean.
I do have users table with uid column in same database. some how im not able to get the point. And how can i avoid the constraint failure. Im sorry im new to yii.. Any help will be appreciated. Thank you.