Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Seniors
craig1617
Commits
2e87f803
Commit
2e87f803
authored
Nov 15, 2016
by
Craig Earley
Browse files
README started, php file that connects to PostgreSQL
parents
Changes
2
Hide whitespace changes
Inline
Side-by-side
README.md
0 → 100644
View file @
2e87f803
# 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
db_link.php
0 → 100644
View file @
2e87f803
<?php
// 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
pg_free_result
(
$result
);
// Closing connection
pg_close
(
$con
);
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment