Advertisement
Guest User

sada

a guest
Nov 26th, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.91 KB | None | 0 0
  1.  
  2. <?php
  3. $con=mysqli_connect("localhost","root","","aaaa");
  4. // Check connection
  5. if (mysqli_connect_errno())
  6.   {
  7.   echo "Failed to connect to MySQL: " . mysqli_connect_error();
  8.   }
  9.  
  10. // Perform a query, check for error
  11. //if (!mysqli_query($con,"INSERT INTO SALA (NUMER,PIETRO) VALUES ('12',123), (123,123)"))
  12. //  {
  13. //  echo("Error description: " . mysqli_error($con));
  14. //  }
  15. $pyt = mysqli_query($con, "SELECT s.ID_SALI, s.NUMER, o.ID_UZYT, o.IMIE, o.NAZWISKO FROM sala s,uzytkownik u,jest_opiekunem op WHERE op.ID_SAL=s.ID_SALI AND op.ID_US=u.ID_UZYT");
  16.  
  17. echo "<table>";
  18. echo "<tr><th>ID_SALI</th><th>NUMER SALI</th><th>ID_USER</th><th>IMIE</th><th>NAZWISKO</th></tr>";
  19.  
  20. while ($tabl = mysqli_fetch_assoc($pyt)) {
  21. echo "<tr><td>{$tabl['ID_SALI']}</td><td>{$tabl['NUMER']}</td><td>{$tabl['ID_USER']}</td><td>{$tabl['IMIE']}</td><td>{$tabl['NAZWISKO']}</td></tr>";
  22. }
  23. echo "</table>";
  24.  
  25. mysqli_close($con);
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement