PageRenderTime 27ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/duplicate_business.php

http://ebpls.googlecode.com/
PHP | 116 lines | 64 code | 12 blank | 40 comment | 2 complexity | 18441b44ad0dfc93e939a35ab79dcd64 MD5 | raw file
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Duplicate Business Establishments</title>
  6. <style type="text/css">
  7. <!--
  8. .style2 {
  9. font-size: 12px;
  10. font-style: italic;
  11. color: #666666;
  12. }
  13. -->
  14. </style>
  15. </head>
  16. <body>
  17. List of Business Business Establishments that may have a possible duplicate business name, <br />
  18. <span class="style2">Note: The records below shows business name that have the same first 10 characters starting fom the left.</span> <br />
  19. <div align="center">
  20. <p>
  21. <?php
  22. // LEO RENTON
  23. // set database server access variables:
  24. $host = "localhost";
  25. $user = "root";
  26. $pass = "elguebpls";
  27. $db = "ebpls";
  28. // open connection
  29. $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
  30. // select database
  31. mysql_select_db($db) or die ("Unable to select database!");
  32. // create query
  33. // LEO RENTON
  34. $query = "SELECT * FROM ebpls_business_enterprise a WHERE (SELECT count(*) FROM ebpls_business_enterprise b WHERE lcase(left(a.business_name,10)) = lcase(left(b.business_name,10))) > 1 order by a.business_name";
  35. // execute query
  36. $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
  37. // see if any rows were returned
  38. if (mysql_num_rows($result) > 0) {
  39. // yes
  40. // print them one after another
  41. //echo "<table cellpadding=10 border=1 class=\"txtwhite\">";
  42. echo "<table width=\"90%\" border=\"1\" cellpadding=\"5\" cellspacing=\"0\" class=\"txtwhite\">";
  43. echo " <tr bgcolor=\"#CCFF99\">
  44. <td> ID</td>
  45. <td> Business Name</td>
  46. <td> Branch</td>
  47. <td> Street</td>
  48. <td> Brgy Code</td>
  49. <td> Contact</td>
  50. <td> SEC</td>
  51. <td> TIN</td>
  52. </tr>";
  53. while($row = mysql_fetch_row($result)) {
  54. echo "<tr>";
  55. echo "<td>".$row[0]."</td>";
  56. echo "<td>" . $row[2]."</td>";
  57. echo "<td>".$row[3]."</td>";
  58. echo "<td>" . $row[6]."</td>";
  59. echo "<td>".$row[7]."</td>";
  60. echo "<td>".$row[14]."</td>";
  61. echo "<td>".$row[22]."</td>";
  62. echo "<td>".$row[23]."</td>";
  63. /*
  64. echo "<td>".$row[3]."</td>";
  65. echo "<td>" . $row[4]."</td>";
  66. echo "<td>".$row[5]."</td>";
  67. echo "<td>".$row[6]."</td>";
  68. echo "<td>" . $row[7]."</td>";
  69. echo "<td>".$row[8]."</td>";
  70. echo "<td>".$row[9]."</td>";
  71. echo "<td>" . $row[10]."</td>";
  72. echo "<td>".$row[11]."</td>";
  73. echo "<td>".$row[12]."</td>";
  74. echo "<td>" . $row[13]."</td>";
  75. echo "<td>".$row[14]."</td>";
  76. echo "<td>".$row[15]."</td>";
  77. echo "<td>".$row[16]."</td>";
  78. echo "<td>" . $row[17]."</td>";
  79. echo "<td>".$row[18]."</td>";
  80. echo "<td>".$row[19]."</td>";
  81. echo "<td>" . $row[20]."</td>";
  82. echo "<td>".$row[21]."</td>";
  83. echo "<td>".$row[22]."</td>";
  84. echo "<td>" . $row[23]."</td>";
  85. echo "<td>".$row[24]."</td>";
  86. echo "<td>".$row[25]."</td>";
  87. */
  88. echo "</tr>";
  89. }
  90. echo "</table>";
  91. }
  92. else {
  93. // no
  94. // print status message
  95. echo "No rows found!";
  96. }
  97. // free result set memory
  98. mysql_free_result($result);
  99. // close connection
  100. mysql_close($connection);
  101. ?>
  102. </div>
  103. </body>
  104. </html>