Helping ordinary people create extraordinary websites!


Overview - get* methods

Overview - get* methods -- Comparison of get* methods

getOne

getOne() fetches the first column of the first row.
string(5) "pinky"

getRow

getRow() fetches the first row.
array(3) {
  [0] => string(5)  "pinky"
  [1] => string(1)  "1"
  [2] => string(20) "pinky@domination.org"
}

getCol

getCol() fetches the first column of all rows.
array(2) {
  [0]=> string(5) "pinky"
  [1]=> string(8) "thebrain"
}

getAssoc

getAssoc() fetches all rows into an array, using the first colum of the rows as array key. This column is removed from the array itself.
array(2) {
  ["pinky"] => array(2) {
    [0] => string(1) "1"
    [1] => string(20) "pinky@domination.org"
  }
  ["thebrain"] => array(2) {
    [0] => string(1) "2"
    [1] => string(20) "brain@dominators.net"
  }
}

getAll

getAll() fetches all columns from all rows into an array.
array(2) {
  [0] => array(3) {
    [0] => string(5) "pinky"
    [1] => string(1) "1"
    [2] => string(20) "pinky@domination.org"
  }
  [1] => array(3) {
    [0] => string(8) "thebrain"
    [1] => string(1) "2"
    [2] => string(20) "brain@dominators.net"
  }
}