好的,我正在尝试显示带有链接的回复的图像。我找到了这段代码,但结果是空的,只有列标题名称出现。有谁知道为什么。
<?php
include 'connect.php';
$sql2 = "SELECT * FROM `images` WHERE `mid`";
$res2 = mysql_query($sql2) or die(mysql_error());
if(mysql_num_rows($res2) == 0){
echo "There are no topics in this forum, <a href=\"./index.php?act=create& id=".$row['id']."\">click here</a> to create a topic!\n";
}else {
echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\" width=\"100%\">\n";
echo "<tr><td colspan=\"4\" align=\"right\"><a href=\"./index.php?act=create&id=".$row['mid']."\">create a topic</a></td></tr>\n";
echo "<tr align=\"center\"><td class=\"forum_header\">Title</td><td class=\"forum_header\">User</td><td class=\"forum_header\">Date Created</td><td class=\"forum_header\">Replies</td></tr>\n";
while($row2 = mysql_fetch_assoc($res2)){
$sql3 = "SELECT * FROM `reply` WHERE `mid`";
$res3 = mysql_query($sql3) or die(mysql_error());
$row3 = mysql_fetch_assoc($res3);
echo "<tr align=\"center\"><td><a href=\"./index.php?act=topic&id=".$row2['mid']."\">".s($row2['name'])."</a></td><td>".uid($row2['who'])."</td><td>".$row2['date']."</td><td>".$row3[reply']."</td></tr>\n";
}
echo "</table>\n";
}
}
}
?>
name 是 mysql 中图片或路径的名称。
表结构
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
代码不起作用。对不起,但天哪,没有答案。