Advertisement
Guest User

Untitled

a guest
Dec 7th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.27 KB | None | 0 0
  1. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~drukowanie tabeli
  2. <?php
  3. if($rezultat=@$polaczenie->query("SELECT * FROM `stacje` WHERE `E` LIKE '".$_POST['opcja']."'"))  {
  4. if($rezultat->num_rows>0){
  5.     while($row=mysqli_fetch_row($rezultat)){
  6.         echo "<table><tr>";
  7.         for($i=0;$i<count($row);$i++){
  8.             print_r("<td>");
  9.             print_r($row[$i].", ");
  10.             print_r("</td>");
  11.         #echo "<br>";
  12.        }
  13.        
  14.     echo "</tr></table>";
  15.     }}}}}
  16. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Drukowanie inputa
  17. if($rezultat=@$polaczenie->query($q1)){
  18. if($rezultat->num_rows>0){
  19.     print_r ("<form action='' method='post'>");
  20.     echo "<input type='text' name='opcja'>";
  21.  echo "<input type='submit' value='Wpisz'></form>";
  22.      $rezultat  ->free_result();
  23. ~~~~~~~~~~~~~~~~~~~~~~~~~~~drukowanie selecta
  24. if($rezultat->num_rows>0){
  25.     print_r ("<form action='' method='post'>");
  26.     echo "<select name='opcja'>";  
  27.     while($row=mysqli_fetch_row($rezultat)){
  28.        
  29.         for($i=0;$i<count($row);$i++){
  30.             print_r("<option value='".$row[$i]."'>".$row[$i]);
  31.             print_r("</option>");
  32.         }
  33.     } echo "</select>";
  34.       echo "<input type='submit' value='Wyslij'></form>";
  35.      $rezultat  ->free_result();
  36. ~~~~~~~~~~~~~~~~~~~~~~~~~~~ query
  37. require_once "connect.php";
  38. $polaczenie=@new mysqli($host,$db_user,$db_password,$db_name);
  39. $polaczenie->set_charset("utf8");
  40. $q1 = "SELECT A FROM `stacje`";
  41.  
  42. ~~~~~~~~~~~~~~~~~~connect
  43.  $host="localhost";
  44.     $db_user="root";
  45.     $db_password="";
  46.     $db_name="baza";
  47.  
  48. ~~~~~~~~~~~~~~OPCJA2
  49. require_once "connect.php";
  50. $polaczenie=@new mysqli($host,$db_user,$db_password,$db_name);
  51. $polaczenie->set_charset("utf8");
  52. $q1 = "SELECT A FROM `stacje`";
  53.  
  54.     if($rezultat=@$polaczenie->query($q1)){
  55. if($rezultat->num_rows>0){
  56.     print_r ("<form action='' method='post'>");
  57.     echo "<input type='text' name='opcja'>";
  58. echo "<input type='submit' value='Wpisz średnią z przecinkiem jako separatorem'></form>";
  59.     print_r("<p><s>Jako separatora użyj przecinka</s>");
  60.      $rezultat  ->free_result();
  61. if($rezultat=@$polaczenie->query("SELECT * FROM `stacje` WHERE `E` LIKE '".$_POST['opcja']."'"))  {
  62. if($rezultat->num_rows>0){
  63.     while($row=mysqli_fetch_row($rezultat)){
  64.         echo "<table><tr>";
  65.         for($i=0;$i<count($row);$i++){
  66.             print_r("<td>");
  67.             print_r($row[$i].", ");
  68.             print_r("</td>");
  69.         #echo "<br>";
  70.        }        
  71.     echo "</tr></table>";
  72.     }}}}}
  73.  
  74.  
  75. ~~~~~~~~~~~~~~opcja1
  76. require_once "connect.php";
  77. $polaczenie=@new mysqli($host,$db_user,$db_password,$db_name);
  78. $polaczenie->set_charset("utf8");
  79. $q1 = "SELECT A FROM `stacje`";
  80.  
  81.     if($rezultat=@$polaczenie->query($q1)){
  82. if($rezultat->num_rows>0){
  83.     print_r ("<form action='' method='post'>");
  84.     echo "<select name='opcja'>";
  85.      #$j=1; #pomocnicza  
  86.    while($row=mysqli_fetch_row($rezultat)){
  87.        
  88.         for($i=0;$i<count($row);$i++){
  89.            
  90.             print_r("<option value='".$row[$i]."'>".$row[$i]);
  91.             print_r("</option>");
  92.             #$j=$j+1;
  93.        
  94.         }
  95.        
  96.     } echo "</select>";
  97.       echo "<input type='submit' value='Wyslij'></form>";
  98.      $rezultat  ->free_result();
  99.  
  100.    
  101. if($rezultat=@$polaczenie->query("SELECT * FROM `stacje` WHERE `A` LIKE '".$_POST['opcja']."'"))  {
  102. if($rezultat->num_rows>0){
  103.     while($row=mysqli_fetch_row($rezultat)){
  104.         echo "<table><tr>";
  105.         for($i=0;$i<count($row);$i++){
  106.             print_r("<td>");
  107.             print_r($row[$i].", ");
  108.             print_r("</td>");
  109.         #echo "<br>";
  110.        }
  111.        
  112.     echo "</tr></table>";
  113.     }}}}}
  114.  
  115.  
  116. ~~~~~~~~~~~~~~~~~~~~ INDEX & CSS
  117. <!DOCTYPE html>
  118. <html lang="en">
  119. <head>
  120.     <title> sy ty a cy jy e</title>
  121.     <style>
  122.         body{background-color: #333;}
  123.        button[type=submit]{
  124. background-color: #555555;
  125. margin: 1%;
  126. width: 40%;
  127. margin-left: 30%;
  128. margin-right: 30%
  129. border: none;
  130. color: white;
  131. padding: 15px 32px;
  132. text-align: center;
  133. text-decoration: none;
  134. display: inline-block;
  135. font-size: 16px;
  136. }
  137.     </style>
  138. </head>
  139. <body>
  140.     <form action="opcja1.php" method="get">
  141.   <button type="submit">tekst1</button><br>
  142.   <button type="submit" formaction="opcja2.php">tekst</button>
  143. </form>
  144.  
  145. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement