PHP generate table example code_PHP tutorial

WBOY
Release: 2016-07-13 17:41:05
Original
1560 people have browsed it

The following code PHP generates a form example, which is posted after being tested by the Programming Home of this site and running normally.

  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. }
  25. print("
  26. $id " );
  27.                                                                                                                                              print("");
  28. }
  29. }
  30. }
  31. print("
  32. ");
  33. mysql_close($link);
  34. ?>
  35. http://www.bkjia.com/PHPjc/486157.html
  36. www.bkjia.com
true
http: //www.bkjia.com/PHPjc/486157.html

TechArticle

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!