From c13a6674433ad2f712c8fa695a60095e4ff39604 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 10 Aug 2007 19:30:24 +0000 Subject: [PATCH] A more elegant way of doing get_col. git-svn-id: http://svn.automattic.com/wordpress/trunk@5861 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/wp-db.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index c30b321935..09461f2bc6 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -310,9 +310,14 @@ class wpdb { else return null; - // Extract the column values - for ( $i=0; $i < count($this->last_result); $i++ ) { - $new_array[$i] = $this->get_var(null, $x, $i); + if ( !$this->last_result ) + return null; + + $i = 0; + foreach( $this->last_result as $row ) { + $arr = array_values( (array) $row ); + $new_array[$i] = $arr[0]; + $i++; } return $new_array; }