PHP Output Form Implementation code (fixed version) _php tutorial

Source: Internet
Author: User
Many of the code on the web is wrong, and the script house has been amended.
Copy CodeThe code is as follows:


<title>Two rows of 5 columns altogether 10 data</title>























$num = 5; Currently each row shows the number of columns $k = 1; Initialize while ($k <=10) {if ($k% $num = = 0) {if ($k ==10) {echo ' '." \ r \ n "; }else{Echo ' '." \ r \ n "; }} else {echo ' '." \ r \ n "; } $k +=1; Self-added}?>
'. $k. '
'. $k. '
'. $k. '




The following are read from the database:
Copy CodeThe 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. = "";
}
}
?>



echo $str;?>

http://www.bkjia.com/PHPjc/322763.html www.bkjia.com true http://www.bkjia.com/PHPjc/322763.html techarticle Many of the code on the Web is wrong, and the script house has been amended. Copy the code code as follows: HTML head title two row 5 column total 10 data/title/head Body table border= "1" width=8 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.