Sto cercando di usare la pillola ma con POSTGRESQL: ho cambiato nella classe la funzione _getPagerData
function _getPagerData ( $numHits, $page ) {
$numHits = (int) $numHits;
$this->limit = max((int) $this->limit, 1);
$this->page = (int) $page;
$this->numPages = ceil($numHits / $this->limit);
$this->page = max($this->page, 1);
$this->page = min($this->page, $this->numPages);
$this->offset = ($this->page - 1) * $this->limit;
$this->sql = " LIMIT ".$this->limit." OFFSET ".$this->offset;
$this->_makeMenu();
}
per adattarla alla sintassi
SELECT * FROM TABELLA LIMIT n OFFSET m
ma non riesco a far andare il codice seguente:
<?
require_once("php.sql.pager.class");
//includo il file di configurazione
require_once("config.inc.php");
$dbconn = pg_connect ($postgres) or die ("BABA");
$_PAGER = new _makePager(3);
$_sql=pg_query($dbconn,"SELECT COUNT(*) FROM \"FOTO\";");
echo "1";
$_PAGER = _getPagerData(pg_fetch_result($_sql),$_GET["p"]);
echo "2";
$_sql = pg_query($dbconn,"SELECT * FROM \"FOTO\" {$_PAGER->sql};");
echo "3";
while ($row = pg_fetch_row($_sql, $i))
{
for ($j=0; $j < count($row); $j++) {
echo "$row[$j]";
}
echo "
";
}
?>
che si ferma senza dare alcun errore stampando solo 1, cioè alla chiamta alla funzione _getPagerData. Ho sostituito l'analogo mysql_result con pg_fetch_result che dovrebbe essere analoga, per cui non capisco cosa fare. :master:

Rispondi quotando