$query = "(SELECt content, title, 'msg' as type FROM messages WHERe content LIKE '%" . $keyword . "%' OR title LIKE '%" . $keyword ."%') UNIOn(SELECt content, title, 'topic' as type FROM topics WHERe content LIKE '%" . $keyword . "%' OR title LIKE '%" . $keyword ."%') UNIOn(SELECt content, title, 'comment' as type FROM comments WHERe content LIKE '%" . $keyword . "%' OR title LIKE '%" . $keyword ."%')";mysql_query($query);
因此,您将从这三个表中得到所有结果,并且可以通过查看其
type值来确定哪个行来自哪个表。



