Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.39 KB | None | 0 0
  1. <?
  2.     session_start();
  3.     $cn = pg_connect("host=localhost port=5432 dbname=james user=james password=james");
  4.     if(!$cn)
  5.     {
  6.         die('failed to connect to database');
  7.     }
  8.    
  9.     $sql = 'SELECT * from xuser';
  10.     $res = pg_query($cn,$sql);
  11.     echo '<pre>';
  12.     while ($row=pg_fetch_row($res)){
  13.         echo $row[0].' '.$row[1].' '.$row[2]."\n";
  14.     }
  15.     echo '</pre>';
  16. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement