search
Homephp教程php手册PHP生成表格实例代码

PHP生成表格实例代码

Jun 13, 2016 am 10:39 AM
phpundercodebackExamplenormaltestgenerateprogrammingsheetrun

下面代码PHP生成表格实例,经过本站编程之家测试正常运行后贴出来的。

  1. $link=mysql_connect("localhost","root","123456");
  2. $db=mysql_select_db("bustest",$link);
  3. $sql1="select name from info group by name order by id asc";
  4. print("");
  5. $res1=mysql_query($sql1);
  6. while($row1=mysql_fetch_array($res1)){
  7.     $name=$row1["name"];
  8.     $sql2="select id from info where name =$name order by id asc";
  9.     $res2=mysql_query($sql2);
  10.     while($row2=mysql_fetch_array($res2)){
  11.         print("
  12. ");
  13.         $id=$row2["id"];
  14.         print("
  15. ");
  16.         $sql3="select count(*),id  from info where name =$name  group by name  order by id asc";
  17.         $res3=mysql_query($sql3);
  18.         while($row3=mysql_fetch_array($res3)){
  19.             $id1=$row3["id"];
  20.             if($id1==$id){
  21.                 $num=$row3[0];
  22.                 print("
  23. ");
  24.             }else{
  25.                 print("
  26. ");
  27.             }
  28.         }
  29.     }
  30.     print("");
  31. }
  32. print("
  33. $id ");
  34.                 print $name;
  35.                 print("
  36. ");
  37. mysql_close($link);
  38. ?>   

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools