我正在运行一个新项目,其中有两个表groups
和members
。它们当时都是空的,并且成员表group_id
有一个预备键约束。
现在我开始创建一个可能稍后有很多成员的组,但是,当我尝试创建它时,我收到以下消息:
SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`cogro`.`groups`, CONSTRAINT `groups_ibfk_1` FOREIGN KEY (`id`) REFERENCES `members` (`group_id`) ON DELETE NO ACTION ON UPDATE NO ACTION)
非常感谢任何帮助或指导。
答案 0 :(得分:2)
您输入了错误的外键方向。目前members.group_id
引用groups
(为了在id = 1
中添加members
条目,您应该在group_id = 1
中添加CONSTRAINT `members_group_id_fk` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`)
的条目<) / p>
将定义更改为:
var myElement = document.getElementById('myCanvas');
var mc = new Hammer(myElement,
{
hold: false,
release: false
});
mc.add(new Hammer.Press({
event: 'press',
pointer: 1,
threshold: 30,
time: 1
}));
mc.on("press", function(event)
{
//This works, but only single touch, until touch is lifted
//can I do second.
x1 = event.center.x;
y1 = event.center.y;
//This doesn't -> Trying new things
x2 = event.touches[1].x;
y2 = event.touches[1].y;
});