Chinaunix首页 | 论坛 | 博客
  • 博客访问: 18298
  • 博文数量: 12
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 125
  • 用 户 组: 普通用户
  • 注册时间: 2014-01-02 14:42
文章分类
文章存档

2015年(5)

2014年(7)

我的朋友
最近访客

分类: PHP

2014-10-03 16:48:41


点击(此处)折叠或打开

  1. 最初级的PHP分类查询程序

  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
  3. <html xmlns="">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>无标题文档</title>
  7. </head>

  8. <body>

  9. <div align="center"><form action="" method="post"><input type="submit" name="sell" value="智慧销售" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  10. <input type="submit" name="manager" value="经营管理"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="serve" value="智慧客服"

  11. />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="newemployee" value="智慧新员工" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input

  12. type="submit" name="development" value="个人发展" /></form>





  13. <?php
  14. if(!empty($_POST['sell'])){

  15. $conn=mysql_connect("localhost","root","root");
  16. if(!$conn){
  17. die('Could not connect the database!');
  18. }
  19. mysql_query("SET NAMES UTF8");
  20. mysql_query("set character_set_client=utf8");
  21. mysql_query("set character_set_results=utf8");
  22. mysql_select_db("test",$conn);
  23. $sql="select * from ts1 where name like '%智慧销售%' ";
  24. $result=mysql_query($sql);
  25. echo '';
  26. while($row=mysql_fetch_assoc($result)){
  27. echo '
  28. ';
  29. echo '
  30. '.''.'';
  31. echo '
  32. ';
  33. }
  34. echo '
  35. '.$row['id'].''.$row['name'].''.$row['image'].'
    '
    ;
  36. mysql_close($conn);
  37. }


  38. ?>
  39. <?php
  40. if(!empty($_POST['serve'])){

  41. $conn=mysql_connect("localhost","root","root");
  42. if(!$conn){
  43. die('Could not connect the database!');
  44. }
  45. mysql_query("SET NAMES UTF8");
  46. mysql_query("set character_set_client=utf8");
  47. mysql_query("set character_set_results=utf8");
  48. mysql_select_db("test",$conn);
  49. $sql="select * from ts1 where name like '%智慧客服%' ";
  50. $result=mysql_query($sql);
  51. echo '';
  52. while($row=mysql_fetch_assoc($result)){
  53. echo '
  54. ';
  55. echo '
  56. '.''.'';
  57. echo '
  58. ';
  59. }
  60. echo '
  61. '.$row['id'].''.$row['name'].''.$row['image'].'
    '
    ;
  62. mysql_close($conn);
  63. }

  64. ?>


  65. <?php
  66. if(!empty($_POST['manager'])){

  67. $conn=mysql_connect("localhost","root","root");
  68. if(!$conn){
  69. die('Could not connect the database!');
  70. }
  71. mysql_query("SET NAMES UTF8");
  72. mysql_query("set character_set_client=utf8");
  73. mysql_query("set character_set_results=utf8");
  74. mysql_select_db("test",$conn);
  75. $sql="select * from ts1 where name like '%经营管理%' ";
  76. $result=mysql_query($sql);
  77. echo '';
  78. while($row=mysql_fetch_assoc($result)){
  79. echo '
  80. ';
  81. echo '
  82. '.''.'';
  83. echo '
  84. ';
  85. }
  86. echo '
  87. '.$row['id'].''.$row['name'].''.$row['image'].'
    '
    ;
  88. mysql_close($conn);
  89. }

  90. ?>
  91. / /
  92. <?php
  93. if(!empty($_POST['newemployee'])){

  94. $conn=mysql_connect("localhost","root","root");
  95. if(!$conn){
  96. die('Could not connect the database!');
  97. }
  98. mysql_query("SET NAMES UTF8");
  99. mysql_query("set character_set_client=utf8");
  100. mysql_query("set character_set_results=utf8");
  101. mysql_select_db("test",$conn);
  102. $sql="select * from ts1 where name like '%智慧新员工%'";
  103. $result=mysql_query($sql);
  104. echo '';
  105. while($row=mysql_fetch_assoc($result)){
  106. echo '
  107. ';
  108. echo '
  109. '.''.'';
  110. echo '
  111. ';
  112. }
  113. echo '
  114. '.$row['id'].''.$row['name'].''.$row['image'].'
    '
    ;
  115. mysql_close($conn);
  116. }

  117. ?>



  118. <?php
  119. if(!empty($_POST['development'])){

  120. $conn=mysql_connect("localhost","root","root");
  121. if(!$conn){
  122. die('Could not connect the database!');
  123. }
  124. mysql_query("SET NAMES UTF8");
  125. mysql_query("set character_set_client=utf8");
  126. mysql_query("set character_set_results=utf8");
  127. mysql_select_db("test",$conn);
  128. $sql="select * from ts1 where name like '%个人发展%' ";
  129. $result=mysql_query($sql);
  130. echo '';
  131. while($row=mysql_fetch_assoc($result)){
  132. echo '
  133. ';
  134. echo '
  135. '.''.'';
  136. echo '
  137. ';
  138. }
  139. echo '
  140. '.$row['id'].''.$row['name'].''.$row['image'].'
    '
    ;
  141. mysql_close($conn);
  142. }

  143. ?>
  144. </div>
  145. </body>
  146. </html>

阅读(311) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~