Advertisement
Guest User

Untitled

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