Advertisement
Guest User

Untitled

a guest
Sep 17th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 KB | None | 0 0
  1. <?php
  2. $input = $_POST['in'];
  3. $link = pg_connect("dbname=test user=root password=338081");
  4. $sql = "select * from data where stuff='$input';";
  5. echo $sql;
  6. $result = pg_exec($link, $sql);
  7. $numrows = pg_numrows($result);
  8. echo "<table>";
  9. for($i = 0; $i < $numrows; $i++) {
  10.     echo "<tr>";
  11.     $row = pg_fetch_array($result, $i);
  12.     echo "<td>" . $row[0] . "</td>";
  13.     echo "<td>" . $row[1] . "</td>";
  14.     echo "</tr>";
  15. }
  16. echo "</table>";
  17.  
  18. ?>
  19.  
  20. <html>
  21.     <head>
  22.     </head>
  23.     <body>
  24.         <form action="" method="post">
  25.             <input type="text" name="in"/>
  26.             <input type="submit" value="Submit"/>
  27.         </form>
  28.     </body>
  29. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement