Bonjour. J'ai quelques problèmes avec

Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
SQL_CALC_FOUND_ROWS
et
Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
SELECT FOUND_ROWS() AS total
Je dois tenir compte des requêtes préparées et je ne trouve aucun ex.
Sauf celles que j'ai vu dans certains forums mais qui ne marche pas
pour moi. Besoin d'aide pour solutionner mon problème svp. Merci.

Mon code test:

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
55
56
57
58
59
60
61
62
63
  $result=$dbh->prepare("
      SELECT
        SQL_CALC_FOUND_ROWS      
        cl.id clid,
        cl.pren clpren,
        cl.nom clnom,
        cl.descp cldescp,
        cl.actif clactif,
        cl.forfait clforfait,
        im.id imid,
        im.img imimg,
        im.descp imdescp,
        im.clid imclid,
        im.catid imcatid,
        ca.id caid,
        ca.cat cacat
      FROM
        client cl
      JOIN image im ON cl.id = im.clid
      JOIN categorie ca ON ca.id = im.catid
  ");
  $result=$dbh->prepare("SELECT FOUND_ROWS() AS total");
 
  $result->execute();
 
  echo '<table>';
    echo '<tr>';
      echo '<th>clid</th>';
      echo '<th>clpren</th>';
      echo '<th>clnom</th>';
      echo '<th>cldescp</th>';
      echo '<th>clactif</th>';
      echo '<th>clforfait</th>';
      echo '<th>imid</th>';
      echo '<th>imimg</th>';
      echo '<th>imdescp</th>';
      echo '<th>imclid</th>';
      echo '<th>imcatid</th>';
      echo '<th>caid</th>';
      echo '<th>cacat</th>';
    echo '</tr>';
 
   while( $row = $result->fetch() )
  {
    echo '<tr>';
      echo '<td>'. $row['clid'] .' </td>';
      echo '<td>'. $row['clpren'] .' </td>';
      echo '<td>'. $row['clnom'] .' </td>';
      echo '<td>'. $row['cldescp'] .' </td>';
      echo '<td>'. $row['clactif'] .' </td>';
      echo '<td>'. $row['clforfait'] .' </td>';
      echo '<td>'. $row['imid'] .' </td>';
      echo '<td>'. $row['imimg'] .' </td>';
      echo '<td>'. $row['imdescp'] .' </td>';
      echo '<td>'. $row['imclid'] .' </td>';
      echo '<td>'. $row['imcatid'] .' </td>';
      echo '<td>'. $row['caid'] .' </td>';
      echo '<td>'. $row['cacat'] .' </td>';
    echo '</tr>';
  }
  echo '</table>';
 
echo $row['total'];