Maison > Article > développement back-end > mysql不能执行两条insert吗?
$sql = "INSERT INTO typecho_contents( title, created, modified, text, authorId, allowComment, allowPing, allowFeed )VALUES ('秘密#$mimiId', '$mimitime', '$mimitime', '$mimicontent', '1', '1', '1', '1');INSERT INTO typecho_relationships(cid, mid) VALUES ('$mimiId', '1')";
INSERT INTO typecho_contents( title, created, modified, text, authorId, allowComment, allowPing, allowFeed )VALUES ('秘密#23', '147852369', '147852369', '为什么', '1', '1', '1', '1');INSERT INTO typecho_relationships(cid, mid) VALUES ('23', '1')
改成
$sql1=mysql_query("INSERT INTO typecho_contents( title, created, modified, text, authorId, allowComment, allowPing, allowFeed )VALUES ('秘密#$mimiId', '$mimitime', '$mimitime', '$mimicontent', '1', '1', '1', '1')");$sql2=mysql_query("INSERT INTO typecho_relationships(cid, mid) VALUES ('$mimiId', '1')");就成功了