summaryrefslogtreecommitdiff
path: root/sqlbox/view.php
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2013-01-25 08:33:05 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2013-01-25 08:48:17 +0100
commit95849a4614a55b46214622f88bb6dbc66cb54725 (patch)
tree7d7324f4a6649f8553ba57b7fcf4122cc0377a37 /sqlbox/view.php
parent2b83a4b36c82b1c990e4152891074079d710bb91 (diff)
downloadsqltutor-plugin-95849a4614a55b46214622f88bb6dbc66cb54725.tar.gz
sqltutor-plugin-95849a4614a55b46214622f88bb6dbc66cb54725.tar.bz2
sqltutor-plugin-95849a4614a55b46214622f88bb6dbc66cb54725.zip
Add settings page for database connection
Diffstat (limited to 'sqlbox/view.php')
-rw-r--r--sqlbox/view.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/sqlbox/view.php b/sqlbox/view.php
index 9efe93b..f79b8dc 100644
--- a/sqlbox/view.php
+++ b/sqlbox/view.php
@@ -87,7 +87,14 @@ $correct = true;
if (isset($data->sqlbox_query)) {
echo $OUTPUT->heading('SQL Query: '.$data->sqlbox_query);
- $db = pg_connect("host=localhost dbname=sqlbox user=sqlbox password=foobar");
+
+ $con = sprintf("host=%s dbname=%s user=%s password=%s",
+ $CFG->sqlbox_hostname ? $CFG->sqlbox_hostname : "localhost",
+ $CFG->sqlbox_database ? $CFG->sqlbox_database : "sqlbox",
+ $CFG->sqlbox_user ? $CFG->sqlbox_user : "sqlbox",
+ $CFG->sqlbox_password ? $CFG->sqlbox_password : "sqlbox_pw" );
+
+ $db = pg_connect($con);
if (!$db)
error("Failed to connect to sqlbox db");