diff options
Diffstat (limited to 'sqlbox/locallib.php')
-rw-r--r-- | sqlbox/locallib.php | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/sqlbox/locallib.php b/sqlbox/locallib.php index 359d5ae..2968e3f 100644 --- a/sqlbox/locallib.php +++ b/sqlbox/locallib.php @@ -40,22 +40,22 @@ defined('MOODLE_INTERNAL') || die(); //} function db_table_from_query($db, $query) { - global $PAGE; + global $PAGE; - $table = new html_table; - $result = @pg_query($db, $query); - if (!$result) - print_error('queryfailed', 'sqlbox', $PAGE->url, pg_last_error($db)); + $table = new html_table; + $result = @pg_query($db, $query); + if (!$result) + print_error('queryfailed', 'sqlbox', $PAGE->url, pg_last_error($db)); - $table = new html_table; - $n = pg_num_fields($result); - for ($i = 0; $i < $n; $i++) - $table->head[] = pg_field_name($result, $i); - $table->align = array_fill(0, $n, 'left'); - while ($row = pg_fetch_row($result)) - $table->data[] = $row; + $table = new html_table; + $n = pg_num_fields($result); + for ($i = 0; $i < $n; $i++) + $table->head[] = pg_field_name($result, $i); + $table->align = array_fill(0, $n, 'left'); + while ($row = pg_fetch_row($result)) + $table->data[] = $row; - return $table; + return $table; } function sqlbox_submit_response($query, $sqlbox, $correct, $userid) { @@ -73,7 +73,7 @@ function sqlbox_submit_response($query, $sqlbox, $correct, $userid) { } $newsolution->query = $query; $newsolution->correct = $correct; - + if ($current) $DB->update_record("sqlbox_solutions", $newsolution); else |