PHP
<?php
/************************************************************
* Pagina's
************************************************************/
if(isset($_GET['pnr']))
{
if( $_GET['pnr'] > 1 )
{
$_GET['pnr']--;
}
$start = $_GET['pnr'] * 5;
}
else
{
$start = 0;
}
/************************************************************
* Reacties
************************************************************/
$ophalen = mysql_query("SELECT * FROM `forum_reacties` WHERE `topic_id` = '" . $topic_id . "' ORDER BY datum LIMIT ". $start .", 5") or die(mysql_error());
$telreacties = mysql_num_rows($ophalen);
while( $output = mysql_fetch_assoc( $ophalen ) ) {
$reacties[] = array(
'id' => $output[ 'id' ],
'reactieauteur' => htmlspecialchars( stripslashes( $output[ 'reactie_auteur' ] ) ),
'bericht' => stripslashes( bbhtml2( $output[ 'reactie_bericht' ] ) ),
'aantal' => stripslashes( $telreacties ),
'datum' => htmlspecialchars( stripslashes( $output[ 'datum' ] ) )
);
}
$core[ 'tpl' ]->assign( 'reacties', $reacties );
/************************************************************
* Pagina's
************************************************************/
$pq = mysql_query( "SELECT count( id ) FROM forum_reacties WHERE `topic_id` = '" . $topic_id . "'" );
$paginas = ceil( mysql_result( $pq, 0, 0 ) / 5 );
$core[ 'tpl' ]->assign( 'paginas', $paginas + 1 );
?>
Meer tonen
Dit zal dan moeten werken, aangezien hij anders het getal als string ziet.