INSERT INTO Reltab(id,tid) VALUES
((SELECT id FROM BlogDetails WHERE Title = '$title'),
(SELECT tid FROM TagTable WHERE tname = '$words[$i]'));
答案 0 :(得分:0)
您应该在此类查询中使用参数。然后,您可以使用join
:
INSERT INTO Reltab (id, tid)
SELECT bd.id, tt.tid
FROM BlogDetails bd JOIN
TagTable tt
ON bd.Title = ? AND tt.tname = ?;