以下触发器工作正常,但是在表和模式更改后的任何错误都会出错:
DROP TRIGGER IF EXISTS `invite`;
DELIMITER //
CREATE TRIGGER `invite` AFTER INSERT ON `Invite_page`
FOR EACH ROW BEGIN
Insert into userpost(userid,url,title,preview,sentiment,time) values(NEW.userid,NEW.url,NEW.title,NEW.preview,NEW.sentiment,NEW.time);
Insert into urlcontent(url,title,preview,sentiment,time) values(NEW.url,NEW.title,NEW.preview,NEW.sentiment,NEW.time);
END
//
DELIMITER ;
错误是:
Error: Unknown column 'userid' in 'NEW'
表正确包含列:
PHP代码:
<?php
$url=$_POST['url'];
$id=$_POST['id'];
$title=$_POST['title'];
$preview=$_POST['preview'];
$sentiment=$_POST['sent'];
$con = mysqli_connect('127.0.0.1', 'root', '', 'karim');
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
return;
}
$date = strtotime(date("Y-m-d H:i:s"));
//echo $datel
$insertQuery1 = "INSERT INTO invite_page(`userid`, `url`, `title`, `preview` ,`sentiment`,`time`) VALUES ('".$id."','".$url."','".$title."','".$preview."','".$sentiment."','".$date."')";
//$insertQuery2 = "INSERT INTO userpost(`url`, `title`, `preview` ,`sentiment`,`time`) VALUES ('".$url."','".$title."','".$preview."','".$sentiment."')";
if (!mysqli_query($con,$insertQuery1))
{
die('Error: ' . mysqli_error($con));
}
echo "Record added successful ..";
?>
我找不到的问题
答案 0 :(得分:0)
触发,一切正确。
错误是由于同一模式中存在另一个触发器。我不知道。
为给您带来的不便而道歉。