在这里,我尝试从我的表单中插入一些数据,但总是没有插入,我不知道错误在哪里,希望有人告诉我:)
我的插入代码
$sql="INSERT INTO $tbl_name (buyername, buyerjob, buyercompany, buyeraddress, buyercity, buyerpost, buyerphone, buyerfax, buyeremail, buyerweb, buyernob, buyertoo, buyerhonor)
`VALUES ('$name', '$job', '$company', '$address', '$city', '$post', '$phone', '$fax', '$email', '$web', '$nob', '$too', '$bhonor')";
有任何错误吗?希望有人帮忙
错误消息
#1452 - Cannot add or update a child row: a foreign key constraint fails
(reg_db.buyer_db, CONSTRAINT buyer_db_ibfk_1 FOREIGN KEY (spouse_id) REFERENCES
spouse_db (spouse_id))
答案 0 :(得分:0)
您没有设置spouse_id字段的值, 但错误消息表明它是必需的,必须设置为spouse_db表中的值。