summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2013-01-26 10:50:10 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2013-01-26 10:53:20 +0100
commitea3050d1734c3d64f5ff7dd1659f48463dab9793 (patch)
tree380acc34124025977d569cb550dbcf3aeff833f3
parentf670f9aaa9e333b8d66309729bce7a8ff94f3960 (diff)
downloadsqltutor-plugin-ea3050d1734c3d64f5ff7dd1659f48463dab9793.tar.gz
sqltutor-plugin-ea3050d1734c3d64f5ff7dd1659f48463dab9793.tar.bz2
sqltutor-plugin-ea3050d1734c3d64f5ff7dd1659f48463dab9793.zip
db_table_from_query: Fix array_fill if no columns were returned
-rw-r--r--sqlbox/locallib.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/sqlbox/locallib.php b/sqlbox/locallib.php
index 2968e3f..e913291 100644
--- a/sqlbox/locallib.php
+++ b/sqlbox/locallib.php
@@ -51,7 +51,7 @@ function db_table_from_query($db, $query) {
$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');
+ $table->align = $n > 0 ? array_fill(0, $n, 'left') : array();
while ($row = pg_fetch_row($result))
$table->data[] = $row;