Bonjour
je suis en train de mettre en place une pagination en jquery et le probleme c'est ce message :
tous est bon dans mes fichier ci dessus
Code : Sélectionner tout - Visualiser dans une fenêtre à part Fatal error: Class 'Pagination' not found in /home/madaimmola/www/nouveau/Pagination.php on line 5
index.php
Getdate.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
50
51
52
53
54 <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script> <link href="css/pagination.css" rel="stylesheet"> <script type="text/javascript"> // Show loading overlay when ajax request starts $( document ).ajaxStart(function() { $('.loading-overlay').show(); }); // Hide loading overlay when ajax request completes $( document ).ajaxStop(function() { $('.loading-overlay').hide(); }); </script> <div class="post-wrapper"> <div class="loading-overlay"><div class="overlay-content">Loading.....</div></div> <div id="posts_content"> <?php //Include database configuration file include('dbConfig.php'); //Include Pagination class file include('Pagination.php'); $limit = 10; $user = 1; //Get the total number of rows $queryNum = $db->query("SELECT COUNT(*) as postNum FROM tchat_live where id_recev = $user"); $resultNum = $queryNum->fetch_assoc(); $rowCount = $resultNum['postNum']; //Initialize Pagination class and create object $pagConfig = array('baseURL'=>'getData.php', 'totalRows'=>$rowCount, 'perPage'=>$limit, 'contentDiv'=>'posts_content'); $pagination = new Pagination($pagConfig); //Get rows $query = $db->query("SELECT * FROM tchat_live where id_recev = $user ORDER BY dure DESC LIMIT $limit"); if($rowCount > 0){ ?> <div class="posts_list"> <?php while($row = $query->fetch_assoc()){ $postID = $row['id']; ?> <div class="list_item"><a href="javascript:void(0);"><h2><?php echo $row["title"]; ?></h2></a></div> <?php } ?> </div> <?php echo $pagination->createLinks(); ?> <?php } ?> </div> </div>
Dbconfig.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 <?php if(isset($_POST['page'])){ //Include database configuration file include('dbConfig.php'); //Include Pagination class file include('Pagination.php'); $start = !empty($_POST['page'])?$_POST['page']:0; $limit = 10; $user = 1; //get number of rows $queryNum = $db->query("SELECT COUNT(*) as postNum FROM tchat_live where id_recev = $user"); $resultNum = $queryNum->fetch_assoc(); $rowCount = $resultNum['postNum']; //initialize Pagination class $pagConfig = array('baseURL'=>'getData.php', 'totalRows'=>$rowCount, 'currentPage'=>$start, 'perPage'=>$limit, 'contentDiv'=>'posts_content'); $pagination = new Pagination($pagConfig); //get rows $query = $db->query("SELECT * FROM tchat_live where id_recev = $user ORDER BY dure DESC LIMIT $start,$limit"); if($rowCount > 0){ ?> <div class="posts_list"> <?php while($row = $query->fetch_assoc()){ $postID = $row['id']; ?> <div class="list_item"><a href="javascript:void(0);"><h2><?php echo $row["message"]; ?></h2></a></div> <?php } ?> </div> <?php echo $pagination->createLinks(); ?> <?php } } ?>
et pagination.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 <?php $dbHost = "***"; $dbUsername = "***"; $dbPassword = "***"; $dbName = "***; // Create database connection $db = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName); // Check connection if ($db->connect_error) { die("Connection failed: " . $db->connect_error); } ?>
j'ai regarder chez mon hebergeur PDO est bien activé
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 <?php // Pagination links configuration $pagConfig = array('baseURL'=>'getData.php', 'totalRows'=>$rowCount, 'perPage'=>$limit, 'contentDiv'=>'posts_content'); // Initialize pagination class $pagination = new Pagination($pagConfig); ?> <!-- Display pagination links --> <?php echo $pagination->createLinks(); ?>
et j'ai souvent cette erreur avec PDO
Partager