如题,新手问题,现在想做个博客,遇到个困难,由于在一个页面中,左侧栏目需要输出Type(博客类型),右侧内容需要输出INformational(博客内容),需要查询两张表并且输出,但是用while后一直报错,无法查询,求解?
------解决思路----------------------
你112行直接用<p>标签,PHP解析是不认的,把那段html文本echo出来,
像“while($row=mysql_fetch_array($result)){
echo "<li><a href='BlogTitle.php?id=".$row['type_id']."'>".$row['type_name']."</a></li>";
}”
这段一样
------解决思路----------------------
<?php
while($r=mysql_fetch_array($result1)){
<p><strong>所有日志 <small>[1033]</small></strong></p>
<h3><strong>[置顶]<span class="text-danger">$r['tb_blog_title']</span>!</strong></h3>
<small class="text-muted">$r['tb_blog_date']</small>
<br>
<h2>$r['tb_blog_title']</h2>
<h4>$r['tb_blog_user']</h4>
<p>$r['tb_blog_content']</p>
<small class="text-danger"><a href="#">阅读全文>></a> </small>
<br>
<p class="text-warning"><a href="#">分类:$r['tb_blog_type'] </a>
------解决思路----------------------
<a href="#"> 阅读(20101) </a>
------解决思路----------------------
<a href="#"> 评论(10)</a> </p>
}
?>
</div>
修改为
<?php
while($r=mysql_fetch_array($result1)){ ?>
<p><strong>所有日志 <small>[1033]</small></strong></p>
<h3><strong>[置顶]<span class="text-danger"><?php echo $r['tb_blog_title']; ?></span>!</strong></h3>
<small class="text-muted"><?php echo $r['tb_blog_date']; ?></small>
<br>
<h2><?php echo $r['tb_blog_title']; ?></h2>
<h4><?php echo $r['tb_blog_user']; ?></h4>
<p><?php echo $r['tb_blog_content']; ?></p>
<small class="text-danger"><a href="#">阅读全文>></a> </small>
<br>
<p class="text-warning"><a href="#">分类:<?php echo $r['tb_blog_type']; ?> </a>
------解决思路----------------------
<a href="#"> 阅读(20101) </a>
------解决思路----------------------
<a href="#"> 评论(10)</a> </p>
<?php
}
?>
</div>