About blog tutorial

Development env

PHP 5.3

Apache 2.2

Yii 1.1.8

Here I got this error below.

CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 1452 Cannot add or update a child row: a foreign key constraint fails (blog.tbl_post, CONSTRAINT FK_post_author FOREIGN KEY (author_id) REFERENCES tbl_user (id)). The SQL statement executed was: INSERT INTO tbl_post (update_time, title, content, tags, status) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4)

Its saying foreign key constraint fails, which means the user doesnt exist in the tbl_user table.

But, the user is in the table.

So, it should be added into post table.

Or, is the error message saying another thing?

Plz help someoneā€¦

You must specify the author_id before insert or update the tbl_post table.


Thank you for ur replay.

I hve added into tbl_post.