Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. <?php
  2. //принимаем данные
  3. $user=$_POST['user'];
  4. $org=$_POST['org'];
  5.  
  6. //соединяемся с БД
  7. $dbconn = pg_connect("host=localhost dbname=passport user=postgres password=Pwd000")
  8. or die('Could not connect: ' . pg_last_error());
  9. //ищем данные о введенной организации
  10. //SELECT name,type,id FROM orgs WHERE CAST(id AS text) LIKE '133%' ORDER BY id
  11. $query = 'SELECT id FROM items WHERE orgid = '.$org.'';
  12. echo $query;
  13. $result = pg_query($query) or die(pg_last_error());
  14. echo "<table>\n";
  15. while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {
  16. echo "\t<tr>\n";
  17. foreach ($line as $col_value) {
  18. echo "\t\t<td>$col_value</td>\n";
  19. }
  20. echo "\t</tr>\n";
  21. }
  22. echo "</table>\n";
  23. // Очистка результата
  24. pg_free_result($result);
  25.  
  26. // Закрытие соединения
  27. pg_close($dbconn);
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement