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) {
if ( $query )
$this->query($query);
else
return null;
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++;
$new_array = array();
// Extract the column values
for ( $i=0; $i < count($this->last_result); $i++ ) {
$new_array[$i] = $this->get_var(null, $x, $i);
}
return $new_array;
}