sto lavorando con PHP e MySQL e improvvisamente ottengoOffset 0 non è valido per MySQL indice di risultato 64 (oppure i dati della query è senza buffer)
mysql_data_seek() [function.mysql-dati-cercare]: L'offset 0 non è valido per l'indice 64 dei risultati MySQL (oppure i dati della query non sono bloccati)
Cosa significa.
Non ho idea di dove iniziare a eseguire il debug di questo.
Questa classe è passato una risorsa mysql in esso del costruttore
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);
}
}
Come di mostrare un po 'di codice. –
scusa, aveva aggiunto il codice ma ha colpito il pulsante backspace al di fuori della casella di testo, ha aggiunto di nuovo il codice. – Hailwood
Prima di chiamare mysql_data_seek, controlla sempre mysql_num_rows (risultato)> = 1. Può essere che il set di risultati sia vuoto –