Leert scripten!
Berichten: 236
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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/************************************************************
* 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 );
?>
|
|
|
Met vriendelijke groeten, mentimjojo
Laatst gewijzigd door mentimjojo op 2012-01-29 16:09:35
29-01-2012 16:07
Dit topic is 273 keer bekeken door 53 verschillende leden
Reacties op: "Reacties weergeven fout."
1 |
2
Reageer op: "Reacties weergeven fout."
1 |
2