我有2张这样的表:
comic_bookmark
+------+----------+
| user | comic |
+------+----------+
| 1 | 1 |
| 1 | 3 |
+------+----------+
comic_comics
+---+---------------+---------------+
| id| name | slug |
+---+---------------+---------------+
| 1 | Superman | super-man |
| 2 | Batman | bat-man |
| 3 | Spiderman | spider-man |
+---+---------------+---------------+
我想让id 1
书签列表的结果显示如下:
- Spiderman
- Superman
我已尝试过一些加入查询的示例,但仍然没有结果。 这是我在此问这个问题之前的最新尝试:
<?
$result = mysql_query("
SELECT a.name, b.comic
FROM comic_bookmark b
INNER JOIN comic_comics a
ON a.id = b.comic
WHERE b.user = 1 ");
while ($row = mysql_fetch_array($result)){
?>
<table class="table">
<td><a href="comic-<?$row['slug']?>.html">Test Output: <?$row['name']?></a></td>
<? } ?>
我真的很新,所以请帮助我。