summaryrefslogtreecommitdiff
path: root/sqlbox/view.php
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-11-23 10:15:28 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-11-23 10:38:38 +0100
commitd1aaba539247b3602d8e7351ecdc694c5cdc33d1 (patch)
tree798cd2289245f8da3cafe5430693b90c64582d0d /sqlbox/view.php
parente20a959086a9f1a9680c0a1cf89c8782a8f0cdb9 (diff)
downloadsqltutor-plugin-d1aaba539247b3602d8e7351ecdc694c5cdc33d1.tar.gz
sqltutor-plugin-d1aaba539247b3602d8e7351ecdc694c5cdc33d1.tar.bz2
sqltutor-plugin-d1aaba539247b3602d8e7351ecdc694c5cdc33d1.zip
sqlbox: Compare user query results from a definable query
Diffstat (limited to 'sqlbox/view.php')
-rw-r--r--sqlbox/view.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/sqlbox/view.php b/sqlbox/view.php
index d095376..5c7c4e1 100644
--- a/sqlbox/view.php
+++ b/sqlbox/view.php
@@ -85,10 +85,15 @@ if (isset($data->sqlbox_query)) {
error("Failed to connect to sqlbox db");
$table = db_get_table_from_query($db, $data->sqlbox_query);
+ $table_orig = db_get_table_from_query($db, $sqlbox->query);
+ pg_close($db);
echo html_writer::table($table);
-
- pg_close($db);
+
+ if ($table->data == $table_orig->data && $table->head == $table->head)
+ echo $OUTPUT->heading("Correct!");
+ else
+ echo $OUTPUT->heading("Incorrect!");
}
// Finish the page