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

php中文网
发布: 2016-07-13 17:41:05
原创
1755人浏览过

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

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

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/486157.htmlTechArticle下面代码PHP生成表格实例,经过本站编程之家测试正常运行后贴出来的。 ?php $link=mysql_connect("localhost","root","123456"); $db=mysql_select_db("bustest"...
相关标签:
php
PHP速学教程(入门到精通)
PHP速学教程(入门到精通)

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号