From 2a14d4ae5af7dd2b08e7a16b155d45cebd3ca763 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Thu, 22 Nov 2012 12:07:35 +0100 Subject: sqlbox: User html_output::table to show query result ..instead of own table code. --- sqlbox/view.php | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'sqlbox/view.php') diff --git a/sqlbox/view.php b/sqlbox/view.php index b45924b..2169ab0 100644 --- a/sqlbox/view.php +++ b/sqlbox/view.php @@ -88,19 +88,16 @@ if (isset($data->sqlbox_query)) { if (!$result) error("Query failed: ".pg_last_error($db)); - echo ""; + $table = new html_table(); $n = pg_num_fields($result); - for ($i = 0; $i < $n; $i++) { - echo ""; - } - while($row=pg_fetch_row($result)){ - echo ""; - foreach($row as $val) { - echo ""; - } - echo ""; - } - echo "
".pg_field_name($result, $i)."
$val
"; + 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; + + echo html_writer::table($table); + pg_close($db); } -- cgit