Many codes on the Internet are wrong, and Script House has specially corrected them.
Copy code The code is as follows:
Two rows and five columns, a total of 10 data
< tr>
$num = 5; //Currently displays the number of columns in each row
$k = 1; //Initialization
while($k<=10)
{
if($k % $num == 0){
if($k==10){
echo ''.$k.' | < /tr>'."rn";
}else{
echo ''.$k.' | '."rn";
}
}
else {
echo ''.$k.' | '."rn";
}
$k+=1; //Add
}
?>
The following is read from the database:
Copy the code The code is as follows:
$sql = "select * from table ";
$query = mysql_query($sql);
$num = mysql_num_rows($query);
for($i=0;$i <$ num;$i++) {
$result = mysql_fetch_array($query);
if($i%3==0){
$str.= "
";
}
$str.= " ".$result[ "title "]. " | ";
if(($i +1)%$num==0) {
$str.= "
";
}
}
?>
http://www.bkjia.com/PHPjc/322763.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322763.htmlTechArticleMany codes on the Internet are wrong, and Script House has specially corrected them. Copy the code. The code is as follows: html head title, two rows and 5 columns, a total of 10 data/title /head body table border="1" width=8...