<?php 
$sqlprotype1="select path FROM {$tbPre}product_type where pid=2";
$resultprotype1=$db->query($sqlprotype1);
while($rsprotype1=$db->fetchArray($resultprotype1)){
?>
<li><a title="<?php echo $rsprotype1['title'];?>" href="<?php echo str_replace(" ",'-',$rsprotype1['url']);?>-<?php echo $rsprotype1['id'];?>.html"><?php echo $rsprotype1['title'];?></a></li>
<?php }?>

解决方案 »

  1.   

    while($rsprotype1=$db->fetchArray($resultprotype1)){ print_r($rsprotype1);
    打印一下能看到数组吗
      

  2.   

    看看输出什么,如果什么都没有,表示$db->fetchArray($resultprotype1)没有数据。<?php 
    $sqlprotype1="select path FROM {$tbPre}product_type where pid=2";
    $resultprotype1=$db->query($sqlprotype1);
    while($rsprotype1=$db->fetchArray($resultprotype1)){
        print_r($rsprotype1);
    ?>
    <li><a title="<?php echo $rsprotype1['title'];?>" href="<?php echo str_replace(" ",'-',$rsprotype1['url']);?>-<?php echo $rsprotype1['id'];?>.html"><?php echo $rsprotype1['title'];?></a></li>
    <?php }?>