Ciao a tutti.
Con la classe qui sopra devo estrarre dei record dal db e metterli in una tabella...inoltre prima dei record devo creare con "$i" un numero che va ad aumentare man mano che crescono i record....il problema è che il risultato nella pagina è solo la tabella senza niente dentro...
Potete aiutarmi?
PHP:
function getRows() {
if(!$this->_sql) {
$this->_error = 'Query per richiamare record non impostata. Call method setSqlSelect()';
return false;
}
if(!$this->_connection) {
$this->_error = 'Database non selezionato. Call method setConnection()';
return false;
}
$cr = 0;
$p = $this->_page - 1;
if($p < 0) {$p = 0;}
$p = $this->_rowsperpage * $p;
$result = mysql_query ($this->_sql . " LIMIT $p, {$this->_rowsperpage}", $this->_connection);
if(!$result) {
$this->_error = 'Errore ' . mysql_error();
return false;
}
if (mysql_num_rows($result) == 0) {
return '';
}
$odd = $even = '';
if($this->odd) {
$odd = ' class="' . $this->odd . '"';
}
if($this->even) {
$even = ' class="' . $this->even . '"';
}
$r = '';
$i = 1;
while ($row = mysql_fetch_assoc($result)) {
$c = '';
foreach($row as $key=>$field) {
$c .= $this->bfm($key, $field);
}
$r .= sprintf($this->tr, $cr ? $odd : $even , $c);
$cr = 1 - $cr;
$i++;
}
return $r;
}
function bfm($fname, $fvalue, $i) {
return sprintf($this->td, $i, $fvalue);
}
Con la classe qui sopra devo estrarre dei record dal db e metterli in una tabella...inoltre prima dei record devo creare con "$i" un numero che va ad aumentare man mano che crescono i record....il problema è che il risultato nella pagina è solo la tabella senza niente dentro...
Potete aiutarmi?