我有 2 个表:1.message 2.replaytomessage
表有 2 个相同的字段:1.title 2.matn
在消息存储主题和 replaytomessage 存储重播到主题 replaytomessage 链接到带有 parentmid 字段的消息
我想在两个表中都写搜索,例如我搜索“测试”,在消息中选择查询查找标题和 matn 并重播消息
我写这个查询:
$result = mysql_query("SELECT * FROM message inner Join replaytomessage On message.mid = replaytomessage.parentmid WHERE message.matn LIKE '%$qfind%' OR message.title LIKE '%$qfind%' ORDER BY message.mid DESC LIMIT $start, $per_page") or die(mysql_error());
但结果显示 replaytomessage 数据或没有正确的标题...
this is my While :
while($row = mysql_fetch_array( $result )) {
echo "<tr>";
echo "<td width = '300'>";
$title = mysql_real_escape_string($row['title']);
$mid = intval($row['mid']);
$member = intval($row['member_id']);
echo "<a href = 'message.php?mid=$mid'>$title</a>";
echo "</td> ";
}