Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- connection.inc
- <?php
- $info = "host=localhost dbname=db_b090904cs user=b090904cs password=roflcopter";
- $conn = pg_connect($info);
- if(!$conn)
- {
- echo "Couldn't Connect To DB";
- exit;
- }
- ?>
- page.php
- <html>
- <head>
- <title>Hotel Project</title>
- </head>
- <body>
- <?php
- require("connection.php");
- $query = "SELECT * FROM RoomType";
- $result = pg_query($conn, $query);
- if (!$result)
- {
- echo "No result..";
- exit;
- }
- echo "<br />";
- echo "
- <table border=1>
- <tr>
- <th>TypeID</th>
- <th>Class</th>
- <th>View</th>
- <th>CapAdult</th>
- <th>CapChild</th>
- </tr> ";
- while ($row = pg_fetch_array($result))
- {
- echo "<tr>";
- echo "<td>".$row[0]."</td><td>".$row[1]."</td><td>".$row[2]."</td><td>".$row[3]."</td><td>".$row[4]."</td></tr>";
- } ;
- echo "</table>";
- ?> <br />
- <form>
- <select name = "test">
- <?
- $res = pg_query($conn, $query);
- while ($r1 = pg_fetch_array($res))
- {
- echo "<option>".$r1[0]."</option>";
- };
- ?>
- </select><br/>
- <input type = "submit" />
- </form>
- <?
- /*
- $arr = pg_fetch_all($result);
- print_r($arr);
- */
- pg_close();
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement