Ciao a tutti....
Avrei bisogni una delucidazione su questa questione:
io ho scaricato da un sito uno script per impaginare i risultati di una query...
Il problema è che in locale funziona e in remoto invece no.
Quando provo a interrogare il db in remoto mi viene restituito questo errore:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-5, 5' at line 1
la riga in questione è questa:
codice:
Codice PHP:
$query_ris = "select nome,username,email,data from users order by $_SESSION[order] $_SESSION[tipo] limit $offset_, $limite";
l'errore in pratica sta nella stringa $offset il cui valore viene restituito da questa funzione:
codice:
Codice PHP:
function getPagerData($numHits, $limit, $page, $off)
{
global $offset,$limit,$page,$numPages,$ret,$off;
$numHits = (int) $numHits;
$limit = max((int) $limit, $off);
$page = (int) $page;
$numPages = ceil
($numHits / $limit);
$page = max($page, 1);
$page = min($page, $numPages);
$offset = ($page- 1) * $limit;
$off = $offset;
$ret = new stdClass;
$ret->offset = $offset;
$ret->limit = $limit;
$ret->numPages = $numPages;
$ret->page = $page;
return $ret;
}
Impostando ad esempio la stringa $limit=5 mi viene fuori che $offset = ($page- 1) * 5, quindi -1*5=-5
se inserisco la query direttamente in mysql in locale mi restituisce lo stesso errore che mi ritorna in remoto, ma testando il sito in locale funziona correttamente.
Ora, qualcuna sa dirmi cosa caspita succede?
Di chi è la colpa? Di php, di MySql, di Apache?.
Illuminatemi per favore....
Grazie