Advertisement
Guest User

Untitled

a guest
Aug 13th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9. include "connetti.php";
  10.  
  11. /*$giorno=date(j);
  12.  
  13. $mese=date(n);
  14.  
  15. $anno=date(Y);
  16.  
  17. */
  18.  
  19.  
  20.  
  21. if($_REQUEST['username'] != null){
  22.  
  23.  
  24.  
  25. $query = "select * from impiegato, turno, turno_has_impiegato where (impiegato.username = '".$_REQUEST['username']."') AND (impiegato.username = turno_has_impiegato.impiegato_username) AND (turno_has_impiegato.turno_idturno = turno.idturno)";
  26.  
  27. $rows = mysql_query($query);
  28.  
  29. echo "username: ".$_REQUEST['username'];
  30.  
  31. echo "<table>";
  32.  
  33. while($row = mysql_fetch_assoc($rows)){
  34.  
  35.  
  36.  
  37. echo "<tr>";
  38.  
  39. echo "<td>";
  40.  
  41. echo "data turno: ".$row['data'];
  42.  
  43. echo "</td>";
  44.  
  45. echo "<td>";
  46.  
  47. echo "ora ingresso: ".$row['oraingresso'];
  48.  
  49. echo "</td>";
  50.  
  51. echo "<td>";
  52.  
  53. echo "ora uscita: ".$row['orauscita'];
  54.  
  55. echo "</td>";
  56.  
  57. echo "</tr>";
  58.  
  59.  
  60.  
  61. }
  62.  
  63. echo "</table>";
  64.  
  65.  
  66.  
  67. }
  68.  
  69. else{
  70.  
  71.  
  72.  
  73. $Data=$anno.'-'.$mese.'-'.$giorno;
  74.  
  75.  
  76.  
  77. /* 24 apr 1.54 so the story begins */
  78.  
  79.  
  80.  
  81. $query = "select * from impiegato";
  82.  
  83. $rows = mysql_query($query);
  84.  
  85.  
  86.  
  87. if(mysql_num_rows($rows) == 0)
  88.  
  89. echo "la tabella è vuota";
  90.  
  91. else{
  92.  
  93. echo "<table>";
  94.  
  95. while($row = mysql_fetch_assoc($rows)){
  96.  
  97. echo "<tr>";
  98.  
  99. echo "<td>";
  100.  
  101. echo "<span class='username'><a href='scriptcomm.php?username=".$row["username"]."'>".$row["username"]."</a></span>";
  102.  
  103. echo "</td>";
  104.  
  105. echo "<td>";
  106.  
  107. echo "<span class='nome'>".$row["nome"]."</span>";
  108.  
  109. echo "</td>";
  110.  
  111. echo "<td>";
  112.  
  113. echo "<span class='cognome'>".$row["cognome"]."</span>";
  114.  
  115. echo "</td>";
  116.  
  117. echo "</tr>";
  118.  
  119. }
  120.  
  121. echo "</table>";
  122.  
  123. }
  124.  
  125. }
  126.  
  127. //function getAllStudents() {
  128.  
  129. /*
  130.  
  131. $Query = "SELECT * FROM commessa;";
  132.  
  133. print("$QUery");
  134.  
  135. $rows=mysql_query($Query);
  136.  
  137. for($index=0;$record=mysql_fetch_assoc($rows);$index++)
  138.  
  139. {
  140.  
  141. foreach($record as $key=>$value)
  142.  
  143. $data[$index][$key]=$value;
  144.  
  145. }
  146.  
  147. return $data;
  148.  
  149. }
  150.  
  151. //per estrare l'array..
  152.  
  153. $elenco=getAllStudents();
  154.  
  155. if(empty($elenco))
  156.  
  157. echo "<BR><BR>Nessuno dato presente";
  158.  
  159. else
  160.  
  161. foreach($elenco as $value)
  162.  
  163. {
  164.  
  165. echo "<strong>".$value['dato1']."</strong>";
  166.  
  167. echo " - ".$value['dato2']." ".$value['dato3'];
  168.  
  169. }
  170.  
  171.  
  172.  
  173. $Res = mysql_query($Query);
  174.  
  175.  
  176.  
  177. if(!$Res)
  178.  
  179. print("Inserimento non riuscito");
  180.  
  181. else
  182.  
  183. print("Inserimento riuscito correttamente");*/
  184.  
  185.  
  186.  
  187. mysql_close($Connessione);
  188.  
  189. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement