Make WordPress Core

Changeset 5861


Ignore:
Timestamp:
08/10/2007 07:30:24 PM (18 years ago)
Author:
matt
Message:

A more elegant way of doing get_col.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/wp-db.php

    r5860 r5861  
    311311            return null;
    312312
    313         // Extract the column values
    314         for ( $i=0; $i < count($this->last_result); $i++ ) {
    315             $new_array[$i] = $this->get_var(null, $x, $i);
     313        if ( !$this->last_result )
     314            return null;
     315
     316        $i = 0;
     317        foreach( $this->last_result as $row ) {
     318            $arr = array_values( (array) $row );
     319            $new_array[$i] =  $arr[0];
     320            $i++;
    316321        }
    317322        return $new_array;
Note: See TracChangeset for help on using the changeset viewer.