下面代码PHP生成表格实例,经过本站编程之家测试正常运行后贴出来的。
- $link=mysql_connect("localhost","root","123456");
- $db=mysql_select_db("bustest",$link);
- $sql1="select name from info group by name order by id asc";
- print("
");- $res1=mysql_query($sql1);
- while($row1=mysql_fetch_array($res1)){
- $name=$row1["name"];
- $sql2="select id from info where name =$name order by id asc";
- $res2=mysql_query($sql2);
- while($row2=mysql_fetch_array($res2)){
- print("
");- $id=$row2["id"];
- print("
$id | ");
- $sql3="select count(*),id from info where name =$name group by name order by id asc";
- $res3=mysql_query($sql3);
- while($row3=mysql_fetch_array($res3)){
- $id1=$row3["id"];
- if($id1==$id){
- $num=$row3[0];
- print("
");- print $name;
- print("
| ");
- }else{
- print("
");
- }
- }
- }
- print("");
- }
- print("
");
- mysql_close($link);
- ?>
-
http://www.bkjia.com/PHPjc/486157.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/486157.htmlTechArticle下面代码PHP生成表格实例,经过本站编程之家测试正常运行后贴出来的。 ?php $link=mysql_connect("localhost","root","123456"); $db=mysql_select_db("bustest"...
Déclaration:Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn