Revert get_col behavior. Props mdawaffe. fixes #4826

git-svn-id: https://develop.svn.wordpress.org/trunk@5950 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2007-08-27 19:44:53 +00:00
parent 81f0bb0ac0
commit f3e9670cfd
1 changed files with 4 additions and 10 deletions

View File

@ -307,17 +307,11 @@ class wpdb {
function get_col($query = null , $x = 0) { function get_col($query = null , $x = 0) {
if ( $query ) if ( $query )
$this->query($query); $this->query($query);
else
return null;
if ( !$this->last_result ) $new_array = array();
return null; // Extract the column values
for ( $i=0; $i < count($this->last_result); $i++ ) {
$i = 0; $new_array[$i] = $this->get_var(null, $x, $i);
foreach( $this->last_result as $row ) {
$arr = array_values( (array) $row );
$new_array[$i] = $arr[0];
$i++;
} }
return $new_array; return $new_array;
} }