Pracuję z php i mysql i nagle dostajęoffset 0 jest nieważny dla MySQL wynik wskaźnika 64 (lub dane zapytanie jest niebuforowana)
mysql_data_seek() [function.mysql-data-seek]: Przesunięcie 0 jest nieprawidłowe dla indeksu wyników MySQL 64 (lub dane zapytania są niebuforowane)
Co to oznacza?
Nie mam pojęcia, od czego zacząć debugowanie tego.
Klasa ta jest przekazywana do zasobu w mysql To konstruktora
class dbResult {
private $result;
private $num_rows;
function __construct($result) {
$this->result = $result;
}
function result($type = 'object') {
@mysql_data_seek($this->result, 0);
if ($type == 'array')
return mysql_fetch_assoc($this->result);
if ($type == 'object') {
if ($this->num_rows() == 1) {
$data = new stdClass();
foreach (mysql_fetch_assoc($this->result) as $k => $v)
$data->$k = $v;
return $data;
}
if ($this->num_rows() > 1) {
$data = array();
while ($result = mysql_fetch_assoc($this->result)) {
$row = new stdClass();
foreach ($result as $k => $v)
$row->$k = $v;
$data[] = $row;
}
return $data;
}
return false;
}
}
function num_rows() {
return mysql_num_rows($this->result);
}
function num_fields() {
return mysql_num_fields($this->result);
}
}
Jak o pokazanie jakiś kod. –
Przepraszam, dodałem kod, ale kliknąłem przycisk Backspace poza polem tekstowym, dodałem kod ponownie. – Hailwood
Przed wywołaniem mysql_data_seek zawsze sprawdzaj mysql_num_rows (result)> = 1. Może być zestaw wyników jest pusty –