Advertisement
Guest User

Untitled

a guest
Aug 7th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. <!--CSS-->
  2. <style type="text/css">
  3. body{ background-color: #151515; font-family: tahoma; }
  4. .td_1 { background-color: #efefef; }
  5. .td_2 { background-color: #fff; }
  6. .td_top { background-color: #000; color: #fff; min-width: 30px; }
  7. .tabulka { margin-top: 150px; margin-left: 150px; }
  8.  
  9. </style>
  10.  
  11. <?php
  12. $dbhost = 'localhost';
  13. $dbuser = 'root';
  14. $dbpass = '';
  15. $dbname = 'test';
  16.  
  17. $conn = mysql_connect($dbhost, $dbuser, $dbpass)
  18. or die ('Error connecting to mysql');
  19.  
  20. $selected = mysql_select_db($dbname, $conn);
  21. /*$selected = mysql_select_db($dbname);*/
  22.  
  23.  
  24. $result = mysql_query("
  25. SELECT
  26. *
  27. FROM
  28. `customers`
  29. ");
  30. /*if echo mysql_num_rows($result)
  31. {
  32. $result = 0;
  33. echo gfdsgdfshfhf
  34. }
  35. */
  36. echo"<table class='tabulka' cellpadding=5 cellspacing=1>
  37. <tr>
  38. <th class='td_top'>ID</th>
  39. <th class='td_top'>Meno</th>
  40. <th class='td_top'>Priezvisko</th>
  41. <th class='td_top'>Tel. Cislo</th>
  42. <th class='td_top'>Poznamka</th>
  43. </tr>";
  44.  
  45. $i = 1;
  46.  
  47. While ($arr = mysql_fetch_assoc($result))
  48. {
  49.  
  50. $pom = $i%2+1;
  51. echo"<tr>
  52. <td class='td_" .$pom . "'>" . $arr['id'] . "</td>
  53. <td class='td_" .$pom . "'>" . $arr['name'] . "</td>
  54. <td class='td_" .$pom . "'>" . $arr['surname'] . "</td>
  55. <td class='td_" .$pom . "'>" . $arr['phone'] . "</td>
  56. <td class='td_" .$pom . "'>" . $arr['note'] . "</td>
  57. </tr>";
  58. $i++;
  59. } // end while..
  60.  
  61. echo"</table>";
  62.  
  63.  
  64. mysql_close($conn);
  65. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement