我已经想出了如何显示带有发布用户评论的图像,但我无法显示其余评论。他们从表中检索多个评论的方法也是如此。他们是在 php 或 msysql 中做到这一点的方法吗?我已经看过了,无法弄清楚。
TABLE Header
username
id
who
where
Table images
message
name
mid - id that auto increments when image is loaded
id
content
Table reply
mid id that is taken from images mid to relate image to reply.
reply
id ----this is only for an id for a reply that is auto increment
表结构在上面
SELECT images.id, images.who, header.username, images.message, images.name, reply.reply
FROM header, images
LEFT JOIN reply ON reply.reply = reply.mid
OR reply.mid = images.mid
WHERE images.name IS NOT NULL = header.id
AND images.who IS NOT NULL
AND images.message IS NOT NULL
GROUP BY images.mid
下面是html结构。
<table>
<tr>
<td>
<a href="a/<?=$name ?>" rel='lightbox' title='$timestamp - $message'> <img src= "a/<?=$name ?>" width='150' height='100'" > </a>
</td>
</tr>
<tr>
<td><?=$row['name'] ?></td>
</tr>
<tr>
<td><?=$row['who'] ?></td>
</tr>
<tr>
<td><?=$row['message'] ?></td>
</tr>
<tr>
<td><?=$row['id'] ?></td>
</tr>
<tr>
<td><?=$row['mid'] ?></td>
</tr>
<tr>
<td><?=$row['username'] ?></td>
</tr>
<tr>
<td><?=$row['reply'] ?></td>
</tr>
</table>
如果您需要对代码或更多代码进行更多说明,请询问。