Home > Backend Development > PHP Tutorial > php输出数据,无法desc解决方法

php输出数据,无法desc解决方法

WBOY
Release: 2016-06-13 10:28:30
Original
1133 people have browsed it

php输出数据,无法desc

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><?php $sql="select C.id,C.number    from cargo1 C left join cargo2 C2 on C.number = C2.number left join cargo3 C3 on C.number = C3.number";    if($_SESSION['filter']){        if(ereg("^[a-zA-Z]*$",$_SESSION['auth'])){            $sql.=" where C.shipper like '%".$_SESSION['filter']."%' or  C.cnee like '%".$_SESSION['filter']."%'";        }else{            $sql.=" where ucase(C.pol)='".$_SESSION['filter']."'";        }//if ereg    }//if    $sql.=" order by C.id desc";    $q=$m->query($sql);    $tb="";    while ($r=$q->fetch_array(MYSQLI_USE_RESULT)){        $tb.="<tr style="white-space:nowrap;">
<td><a href="javascript:void(0);" onclick='ajaxDo(\"showInput\",\"ajaxDo.php?t=display&number=".$r[number]."\",\"showMain\")' title="View details/查看更多...">".$r[number]."</a></td>
<td>".$r[shipper]."</td>
<td>".$r[cnee]."</td>
<td>".$r[po]."</td>
<td>".$r[invoice]."</td>
<td>".$r[pol]."</td>
<td>".$r[pod]."</td>            <td>".$r[dest]."</td>
<td>".$r[vessel]."</td>
<td>".$r[bookingDate]."</td>
<td>".$r[receivedBooking]."</td>
<td>".$r[confirmSpace]."</td>
</tr>";    }?><div class="show">    <table cellpadding="0" cellspacing="0" border="0" class="display" id="example" width="100%">    <thead>        <tr style="white-space:nowrap;">                  <th>編號</th>            <th>出貨人</th>             </tr>    </thead>    <tbody>        <?php echo $tb;?>    </tbody>    <tfoot>        <tr style="white-space:nowrap;">                  <th>編號</th>            <th>出貨人</th>          </tr>    </tfoot>
</table>
<br><br>sql代码见上,但是无法让结果,倒述啊。是何原因,在mysql单独执行那条语句是正确的(desc),就是通过while输出时,仍为asc,这是何故啊??<br><br><font color="#e78608">------解决方案--------------------</font><br>while ($r=$q->fetch_array(MYSQLI_USE_RESULT))  <br>MYSQLI_USE_RESULT<br><font color="#e78608">------解决方案--------------------</font><br>$r=$q->fetch_array(MYSQLI_ASSOC);<div class="clear">
                 
              
              
        
            </div>
</div>
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