【PHP新手有关问题】想在同一页查询两张表内容输出

WBOY
Release: 2016-06-13 12:16:16
Original
1367 people have browsed it

【PHP新手问题】想在同一页查询两张表内容输出
如题,新手问题,现在想做个博客,遇到个困难,由于在一个页面中,左侧栏目需要输出Type(博客类型),右侧内容需要输出INformational(博客内容),需要查询两张表并且输出,但是用while后一直报错,无法查询,求解?
------解决思路----------------------
你112行直接用

标签,PHP解析是不认的,把那段html文本echo出来,
像“while($row=mysql_fetch_array($result)){
                                               echo "

  • ".$row['type_name']."
  • ";
                                                    }”
    这段一样
    ------解决思路----------------------
    <br />               <?php<br />                   while($r=mysql_fetch_array($result1)){<br />                  <p><strong>所有日志 <small>[1033]</small></strong></p><br />                    <h3><strong>[置顶]<span class="text-danger">$r['tb_blog_title']</span>!</strong></h3><br />                    <small class="text-muted">$r['tb_blog_date']</small><br />                  <br><br />                   <h2>$r['tb_blog_title']</h2><br />                   <h4>$r['tb_blog_user']</h4><br />                   <p>$r['tb_blog_content']</p><br />                   <small class="text-danger"><a href="#">阅读全文>></a> </small><br />                   <br><br />                   <p class="text-warning"><a href="#">分类:$r['tb_blog_type']  </a> <br><font color='#FF8000'>------解决思路----------------------</font><br><a href="#"> 阅读(20101) </a> <br><font color='#FF8000'>------解决思路----------------------</font><br> <a href="#"> 评论(10)</a> </p><br />                   }<br />                    <br />                       ?><br />                </div><br />
    Copy after login


    修改为

    <br /><?php<br />   while($r=mysql_fetch_array($result1)){ ?><br />  <p><strong>所有日志 <small>[1033]</small></strong></p><br />    <h3><strong>[置顶]<span class="text-danger"><?php echo $r['tb_blog_title']; ?></span>!</strong></h3><br />    <small class="text-muted"><?php echo $r['tb_blog_date']; ?></small><br />  <br><br />   <h2><?php echo $r['tb_blog_title']; ?></h2><br />   <h4><?php echo $r['tb_blog_user']; ?></h4><br />   <p><?php echo $r['tb_blog_content']; ?></p><br />   <small class="text-danger"><a href="#">阅读全文>></a> </small><br />   <br><br />   <p class="text-warning"><a href="#">分类:<?php echo $r['tb_blog_type']; ?>  </a> <br><font color='#FF8000'>------解决思路----------------------</font><br><a href="#"> 阅读(20101) </a> <br><font color='#FF8000'>------解决思路----------------------</font><br> <a href="#"> 评论(10)</a> </p><br />   <?php<br />    }<br />    <br />       ?><br /></div><br />
    Copy after login
    Related labels:
    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!