/** * Get result data. * @param int The row number from the result that's being retrieved. Row numbers start at 0. * @param int The offset of the field being retrieved. * @return array|false The contents of one cell from a MySQL result set on success, or false on failure. */ public function query_result($row, $field = 0) { if (0 == $this->result->num_rows) { return false; } $this->result->data_seek($row); $datarow = $this->result->fetch_array(); return $datarow[$field]; }
/** * Rewind */ public function rewind() { if ($this->position !== 0) { if ($this->isBuffered === false) { throw new Exception\RuntimeException('Unbuffered results cannot be rewound for multiple iterations'); } } $this->resource->data_seek(0); // works for both mysqli_result & mysqli_stmt $this->currentComplete = false; $this->position = 0; }
/** * Rewind * */ public function rewind() { $this->currentComplete = false; $this->position = 0; if ($this->resource instanceof \mysqli_stmt) { //$this->resource->reset(); } else { $this->resource->data_seek(0); // works for both mysqli_result & mysqli_stmt } }
/** * Seeks to an arbitrary row in statement result set * @link http://www.php.net/manual/en/mysqli-stmt.data-seek.php * @param offset int <p> * Must be between zero and the total number of rows minus one (0.. * mysqli_stmt_num_rows - 1). * </p> * @return \classes\database\statement\MysqliPrepareStmt */ public function dataSeek($offset) { $this->stmt->data_seek($offset); return $this; }
/** * Moves internal result pointer. * * @param int $rowNumber Where to place the result pointer (0 = start) * @return bool Returns TRUE on success or FALSE on failure. * @api */ public function seek($rowNumber) { $success = $this->statement->data_seek((int) $rowNumber); if ($this->statement instanceof \mysqli_stmt) { // data_seek() does not return anything $success = TRUE; } return $success; }
public function seek($row) { $this->rowNum = $row - 1; $this->statement->data_seek($row); return $this->next(); }