Advertisement
Guest User

Untitled

a guest
Dec 9th, 2018
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. <html>
  2.  
  3. <?php
  4.  
  5.  
  6. $Host='127.0.0.1';
  7. $DBase='oswiata';
  8. $FUser='root';
  9. $FPass='';
  10.  
  11.  
  12. function polacz( $host,$dbase,$user, $pass )
  13. {
  14. @$pol=mysql_connect( $host, $user, $pass );
  15. if( !$pol )
  16. {
  17. echo 'BÅ‚ad polaczenia z Serwerem Bazy Danych';
  18. exit();
  19. }
  20. else
  21. {
  22. @mysql_select_db( $dbase );
  23. if( mysql_errno() )
  24. {
  25. echo mysql_errno() . ': '. mysql_errno();
  26. echo mysql_error();
  27. exit();
  28. }
  29. }
  30. return $pol;
  31. }
  32.  
  33. $idpol=polacz($Host, $DBase, $FUser, $FPass);
  34. $nr_stud=$_GET['id'];
  35.  
  36.  
  37. $wyn="SELECT * FROM OCENY WHERE NR_STUD=" . $nr_stud;
  38.  
  39.  
  40. echo "<table>" ;
  41. echo"<tr style='background-color:blue;'>";
  42. echo "<th>NR_STUD</th>";
  43. echo "<th>NR_PRZED</th>";
  44. echo "<th>DATA_ZAL</th>";
  45. echo "<th>TERMIN</th>";
  46. echo "<th>ZAL_EGZ</th>";
  47. echo "<th>OCENA</th>";
  48. echo "</tr> ";
  49.  
  50. @$wyniki=mysql_db_query($DBase, $wyn , $idpol);
  51.  
  52. $parzyste = 1;
  53. while($wiersz=mysql_fetch_row($wyniki))
  54. {
  55. if($parzyste % 2 == 0)
  56. {
  57. echo "<tr style='background-color:lime;'>";
  58. }else
  59. {
  60. echo "<tr style='background-color:yellow;'>";
  61. }
  62.  
  63. echo "<td>", $wiersz[0],"</td>";
  64. echo "<td>", $wiersz[1],"</td>";
  65. echo "<td>", $wiersz[2],"</td>";
  66. echo "<td>", $wiersz[3],"</td>";
  67. echo "<td>", $wiersz[4],"</td>";
  68. echo "<td>", $wiersz[5],"</td>";
  69. echo "</tr>";
  70. $parzyste = $parzyste+1;
  71. }
  72. echo "</table>";
  73.  
  74.  
  75.  
  76. ?>
  77.  
  78. <html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement