Bonjour
S'il vous plait aidez moi je suis débutant en PHP5 je veux afficher mais avec une limit

article.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
 // début d'affichage tous les articles resume
        function showAllArticles4($champs=null){
        if($champs==null){
            $champs = "*";                   
        }    
        $sql ="SELECT $champs FROM $this->table ORDER BY id DESC";
        $req = mysql_query($sql);
        while($data = mysql_fetch_assoc($req)){
            $tableau[] = $data;
        }
        return $tableau;
    }
 
    // Fin d'affichage
index.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
     <?php
 
            $article = new articlesManager();
            $articles = $article->showAllArticles4();
            //$articles = $article->showAllArticles('articles','id,title');
            ?>
 
   <div class="row">
  <div class="col-md-3">
  <div class="list-group ">
 
  <div class="scroll1">
     <?php foreach($articles as $value): ?>
 
  <a href="article.php?id=<?php echo $value['id']; ?>" class="list-group-item2"><?php echo $value['news']; ?></a>
 
   <?php endforeach ?>