PHP生成表格实例代码_PHP教程

WBOY
发布: 2016-07-13 17:41:05
原创
1542 人浏览过

下面代码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. ?>   

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/486157.htmlTechArticle下面代码PHP生成表格实例,经过本站编程之家测试正常运行后贴出来的。 ?php $link=mysql_connect("localhost","root","123456"); $db=mysql_select_db("bustest"...
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!