Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.76 KB | None | 0 0
  1. <?php
  2.                 require 'login.php';
  3.                 $db_server = pg_connect(host=$db_hostname, port=$db_port, user=$db_username, password=$db_password);
  4.                 if(!$db_server) die("Unable to connect: " . pg_error());
  5.                
  6.                 pg_select_db($db_database)
  7.                 or die("Unable to select database: " . pg_error());
  8.                
  9.                 $query = "SELECT * FROM CSGames";
  10.                 $result = pg_query($query);
  11.                 if (!result) die ("Database access failed: " . pg_error());
  12.                
  13.                 $rows = pg_num_rows($result);
  14.                
  15.                 for ($j = 0 ; $j < $rows ; ++$j)
  16.                 {
  17.                     $row = pg_fetch_row($result);
  18.                     echo 'Title: ' .        $row[0] . '<br / >';
  19.                     echo 'Platform: ' .     $row[1] . '<br / >';
  20.                     echo 'Description: ' .  $row[2] . '<br / >';
  21.                     echo 'Price: ' .        $row[3] . '<br / ><br / >';
  22.                 }
  23.                 ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement