i am trying to create an application "create user comment" in my project. i see "comment model" in rules function product_id is required, in this time if i post my form that time i found an error i.e,
Please fix the following input errors:
Product cannot be blank.
if i product_id(foreign key for the comment table) remove from required then post the form, this time give the another error i.e,
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 (technoc1_notjustprice
.tbl_comment
, CONSTRAINT FK_comment_product
FOREIGN KEY (product_id
) REFERENCES tbl_product_index
(product_id
) ON DELETE CASCADE). The SQL statement executed was: INSERT INTO tbl_comment
(content
, status
, create_time
, author
, email
, url
) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5) .
how to remove these errors please help me…
my files are in below…
…