Home > Backend Development > PHP Tutorial > 循环如果不够个数的话怎么还让其循环?

循环如果不够个数的话怎么还让其循环?

WBOY
Release: 2016-06-13 12:52:46
Original
895 people have browsed it

循环如果不够个数的话如何还让其循环??

类似于上面的样子,里面的每行数据都是循环出来的,但是加入只有2条数据的话肯定就只输出2行了,剩余的6行压根就会不显示。
怎么才能让剩余的6行进行空输出以保证整个表格的样式的规整?


------解决方案--------------------
$db->Query("list","select * from #@__cp where `pid`=$row[id] order by `id` desc");
$h = 8; //你需要的行数
for($i=0; $i   if($res=$db->GetArray("list")) {
?>

  =$res[title]?>
  =$res[gangzhong]?>
  =$res[biaozhun]?>
  =$res[guige]?>
  =$res[weight]?>
  =$res[amount]?>
  =$res[single_price]?>
  =$res[total_price]?>
  =$row[content]?>


  }else {
    echo "
 
 
 
 
 
 
 
 
 
 
";
  }
}
?>
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