Heey allemaal,
Ik bouw momenteel een forum, en het werkt. Reactie systeem werkte ook, maar nu moet ik er een pagina systeem in bouwen. Dit werkt alleen niet. Zie de code.
Hij laat de reacties niet meer zien. De fout zit hem bij de query $ophalen, want als ik daar $start weg haal komen de reacties weer. Dit systeem moet 5 reacties per pagina laten zien.
PHP
/************************************************************\
* Pagina's
\************************************************************/
$_GET[ 'pnr' ] = ( !isset( $_GET[ 'pnr' ] ) || $_GET[ 'pnr' ] == '' || $_GET[ 'pnr' ] == 1 || !is_numeric( $_GET[ 'pnr' ] ) ) ? 0 : $_GET[ 'pnr' ];
if( $_GET[ 'pnr' ] > 1 ) {
$_GET[ 'pnr' ]--;
}
$start = $_GET[ 'pnr' ] * 5;
/************************************************************\
* Reacties
\************************************************************/
$ophalen = mysql_query("SELECT * FROM `forum_reacties` WHERE `topic_id` = '" . $topic_id . "' ORDER BY datum LIMIT '" . $start . "', 5");
$reacties = array( );
while( $output = mysql_fetch_assoc( $ophalen ) ) {
$ophalen1 = mysql_query(" SELECT * FROM forum_reacties WHERE topic_id = '" . $topic_id . "'");
$telreacties = mysql_num_rows($ophalen1);
$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 );
?>
Toon Meer
Met vriendelijke groeten, mentimjojo