Advertising
- Anonymous
- Sunday, September 23rd, 2007 at 3:05:19am UTC
- <html>
- <head>
- <title>Player Stats 2006 / 2007</title>
- </head>
- <body>
- <?php
- // Connecting, selecting database
- $dbconn = pg_connect("host=localhost dbname=postgres user=matthew password=password")
- or die('Could not connect: ' . pg_last_error());
- // Performing SQL query
- $query = 'SELECT * FROM stuff';
- $result = pg_query($query) or die('Query failed: ' . pg_last_error());
- // Printing results in HTML
- echo "<table width=100%>\n";
- while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {
- echo "\t<tr>\n";
- foreach ($line as $col_value) {
- echo "\t\t<td>$col_value</td>\n";
- }
- echo "\t</tr>\n";
- }
- echo "</table>\n";
- // Free resultset
- pg_free_result($result);
- // Closing connection
- pg_close($dbconn);
- ?>
- </body>
- </html>
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.