summaryrefslogtreecommitdiff
path: root/sqlbox
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-11-21 10:49:44 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-11-21 11:01:07 +0100
commitf1234ad5c967e2fc3f18662d32362cdfc5a93495 (patch)
tree1bb1a295e6701cd4d0a2556a60f174358e619301 /sqlbox
parent4e71a612e6449cf022b948e0d1db4fa8e258281d (diff)
downloadsqltutor-plugin-f1234ad5c967e2fc3f18662d32362cdfc5a93495.tar.gz
sqltutor-plugin-f1234ad5c967e2fc3f18662d32362cdfc5a93495.tar.bz2
sqltutor-plugin-f1234ad5c967e2fc3f18662d32362cdfc5a93495.zip
wip
Diffstat (limited to 'sqlbox')
-rw-r--r--sqlbox/view.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/sqlbox/view.php b/sqlbox/view.php
index ee30811..0f371b8 100644
--- a/sqlbox/view.php
+++ b/sqlbox/view.php
@@ -77,7 +77,24 @@ echo $OUTPUT->heading('Yay! It works!');
$form = new mod_sqlbox_form($PAGE->url->out(false));
$form->display();
-print_r($form->get_data());
+$data = $form->get_data();
+
+echo $OUTPUT->heading('Query: '.$data->query);
+if (isset($data->query)) {
+ $db = pg_connect("host=localhost dbname=sqlbox user=sqlbox password=foobar");
+ if (!db)
+ error("Failed to connect to sqlbox db");
+
+ $result = pg_query($db, $data->query);
+ if (!$result)
+ error("Query failed!");
+
+ while($row=pg_fetch_row($result)){
+ print_r($row);
+ echo "<br />\n";
+ }
+}
+
// Finish the page
echo $OUTPUT->footer();