Advertisement
Guest User

Untitled

a guest
Jan 24th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. <?php
  2.  
  3. $username="root";
  4.  
  5. $password="";
  6.  
  7. $database="frimaos";
  8.  
  9. mysql_connect('localhost',$username,$password);
  10.  
  11. @mysql_select_db($database) or die("Nie odnaleziono bazy danych");
  12.  
  13. $query="SELECT * FROM `pracownicy`";
  14.  
  15. $result=mysql_query($query);
  16.  
  17. $num=mysql_numrows($result);
  18.  
  19. mysql_close();
  20.  
  21. $i=0;
  22. echo "<table border='1'>";
  23. echo "<tr style='font-weight:bold;'>";
  24. echo "<td>ID</td>";
  25. echo "<td>Nazwisko</td>";
  26. echo "<td>Imie</td>";
  27. echo "<td>Pesel</td>";
  28. echo "<td>Stanowisko</td>";
  29. echo "</tr>";
  30. while ($i < $num) {
  31.  
  32. echo "<tr>";
  33. echo "<td>".mysql_result($result,$i,"id_p")."</td>";
  34. echo "<td>".mysql_result($result,$i,"nazwisko")."</td>";
  35. echo "<td>".mysql_result($result,$i,"imie")."</td>";
  36. echo "<td>".mysql_result($result,$i,"pesel")."</td>";
  37. echo "<td>".mysql_result($result,$i,"stanowisko")."</td>";
  38. echo "</tr>";
  39.  
  40. echo "<br>";
  41.  
  42.  
  43.  
  44. $i++;
  45.  
  46. }
  47. echo "</table>";
  48. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement