douyi8732 2011-07-13 10:16
浏览 17

帖子重叠

Now i dont know if this is simple or hard. If its just css or php code i need
But basically i have posting system and users can comment on posts. In the comments page it shows orginal post and one users have left (the comments)
I had one in there and this was fine but i added another and it looked like this...

[1]: http://i.stack.imgur.com/2fIXd.jpg
As you can see its completly different! Heres my code for it...

<?php           
mysql_connect("localhost", "root", "");      
mysql_select_db("test");           
echo "<a href='Untitled9.php'>Go Back...</a>"; 
?> 
<br/><br/> 

<div class="message">
<?php 
$sql = mysql_query("SELECT * FROM threads WHERE id = '". 
mysql_real_escape_string($_GET['id']) . "'") or die(mysql_error());         
 while($r = mysql_fetch_array($sql))  {         
 $posted = date("jS M Y h:i",$r['posted']); echo "".$r['author']." &nbsp; $posted"; ?> 
<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-text="<?php echo "".$r['message'].""; ?>">
        Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<div class="message2"><?php echo "&nbsp;".$r['message'].""; ?></div> 
<?php  echo "Likes: ".$r['votes_up']."&nbsp;"; echo "Dislike: ".$r['votes_down']."";>        
</div>
<br/>
<hr width="725px">

<?php    
echo "<h3>Replies...</h3>"; ?>
<div class="message"><?php          
$sql = mysql_query("SELECT * FROM replies WHERE thread = '".
mysql_real_escape_string($_GET['id']) . "'") or die(mysql_error());          
while($r = mysql_fetch_array($sql)) {          
$posted = date("jS M Y h:i",$r['posted']); echo "".$r['author']." &nbsp; $posted"; ?>
<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-text="<?php echo "".$r['message'].""; ?>">
        Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>  
<div class="message2">
<?php echo "&nbsp;".$r['message']."" ; } ?> </div> 
</div>

<hr width="725px">

<form action="newreply.php" method="POST">      
Your Name: <input type="text" name="author">      
<input type="hidden" value="<?php echo $_GET['id']; ?>" name="thread"><br>      
Message:<br><textarea cols="60" rows="5" name="message"></textarea><br>      
<input type="submit" value="Post Reply">      
</form>


The code looks really messy on here. I tried editing but couldnt get much better.
So bascially what i want to know is how do i prevent this (the overlapping) from happening?
Edit * CSS

.message {
width: 500px;
    color: black;
    background: white;
    padding:8px;
    border:1px solid white;
    margin:5px auto;
    -moz-border-radius:8px;
}   

.message2 {
background-color: grey;
}   

It looks to me as though everything is posting inside the second php function but i have some code pretty much the same for just the individual post and this displays normally i.e. as many as i want. Im just wondering is there something i need to add/change

  • 写回答

2条回答 默认 最新

  • dongpao5261 2011-07-13 13:13
    关注

    Wrong (Your code):

    <?php echo "&nbsp;".$r['message']."" ; } ?> </div> 
    </div>
    

    Correct:

    <?php echo "&nbsp;".$r['message']."" ; ?> </div> 
    </div>
    <?php } ?>
    

    You were opening multiple DIVs in your while loop but only closing two.

    评论

报告相同问题?

悬赏问题

  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数