Commit 2e87f803 authored by Craig Earley's avatar Craig Earley
Browse files

README started, php file that connects to PostgreSQL

# About
This is Craig Earley's Earlham 2016 senior project.
More details as the code is developed.
# Code
The code will eventually include:
- db_link.php to connect to a PostgreSQL database and store a record
- manifest.json and other non-standard standard Chrome Extension baseline files
- html code for the web page
// Connecting, selecting database
$user = "";
$pass = "";
$db = "test";
$con = pg_connect("dbname=$db user=$user password=$pass")
or die ("Could not connect to server\n");
// Performing SQL query
$query = 'SELECT * FROM agency limit 10';
$result = pg_query($query) or die('Query failed: ' . pg_last_error());
// Printing results in HTML
//echo "<table>\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";
echo "done\n";
// Free resultset
// Closing connection
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment