Comment programmer mon code pour afficher un article complet

Résolu
ghisloy Messages postés 137 Statut Membre -  
ghisloy Messages postés 137 Statut Membre -
Bonjour,
je fais un site dynamique mais j'ai un souci. sur ma page d'accueil, je fais afficher mes actualités en 320 caractères mais quelles requêtes écrire pour que a chaque fois qu'on clic sur lire la suite cela affiche l article complet ?

merci de m'aider

1 réponse

  1. samyb2313 Messages postés 56 Statut Membre 5
     
    Créer une page article qui affiche la totalité de ton article !

    href='monsite?article=12'
    0
    1. ghisloy Messages postés 137 Statut Membre
       
      j'ai fais la page et écris ceci dessus:
      <code sql> <?php
      $lire=isset($_GET['lire'])?$_GET['lire']:0;
      $sql="SELECT * FROM `actualites` WHERE md5(numero)='$lire' LIMIT 1;"; $r=$mysql->run($sql);
      if(count($r)==0){
      $sql="SELECT * FROM `actualites` WHERE 1 ORDER BY publie DESC LIMIT 10 ;";
      $r=$mysql->run($sql); echo $mysql->error; for($i=0; $i<count($r); $i++){?>
      <div style="margin-bottom:10px;">
      <a style="color:#999;" href="<?php echo $UP; ?>htdocs/actualites/?lire=one&id=<?php echo md5($r[$i]["numero"]) ?>">
      <img src="<?php echo $UP; ?>images/actualites/<?php echo $r[$i]['image']; ?>" width="200" style="float:left; margin-right:10px;"></a>
      <h3 style="font-size:17px; margin-bottom:0; padding-bottom:5px;">
      <a style="color:#999; text-decoration:none;" href="<?php echo $UP; ?>htdocs/Actualites/?lire=one&id=<?php echo md5($r[$i]["numero"]) ?>">
      <strong style="color:#1182B5; font-weight:bold; font-size:16px;"><?php echo stripslashes($r[$i]['titre']); ?></strong></a>
      </h3>
      <?php echo $func->fDate(substr($r[$i]["publie"], 0, 10)) ?><br>

      </div><?php
      cependant je recois l'erreur que voici: ''Notice: Undefined variable: mysql in C:\Program Files (x86)\EasyPHP-12.1\www\ESTABAT_LOME\htdocs\Actualites\index.php on line 45

      Fatal error: Call to a member function run() on a non-object in C:\Program Files (x86)\EasyPHP-12.1\www\ESTABAT_LOME\htdocs\Actualites\index.php on line 45'' NB: ma ligne 45 est celle sur laquelle il y select * from actualites
      0
    2. samyb2313 Messages postés 56 Statut Membre 5
       
      peut etre mais c'est la ligne précédente qui pose probleme !

      $r=$mysql->run($sql);

      Ton code met le entre les balise <code > c'est plus lisible !

      Il ne connait pas la function run ! il ne connait pas $mysql !!!
      0
      1. ghisloy Messages postés 137 Statut Membre > samyb2313 Messages postés 56 Statut Membre
         
        $lire=isset($_GET['lire'])?$_GET['lire']:0;
        $sql="SELECT * FROM `actualites` WHERE md5(numero)='$lire' LIMIT 1;"; $r=$mysql->run($sql);
        if(count($r)==0){
        $sql="SELECT * FROM `actualites` WHERE 1 ORDER BY publie DESC LIMIT 10 ;";
        $r=$mysql->run($sql); echo $mysql->error; for($i=0; $i<count($r); $i++){?>
        <div style="margin-bottom:10px;">
        <a style="color:#999;" href="<?php echo $UP; ?>htdocs/actualites/?lire=one&id=<?php echo md5($r[$i]["numero"]) ?>">
        <img src="<?php echo $UP; ?>images/actualites/<?php echo $r[$i]['image']; ?>" width="200" style="float:left; margin-right:10px;"></a>
        <h3 style="font-size:17px; margin-bottom:0; padding-bottom:5px;">
        <a style="color:#999; text-decoration:none;" href="<?php echo $UP; ?>htdocs/Actualites/?lire=one&id=<?php echo md5($r[$i]["numero"]) ?>">
        <strong style="color:#1182B5; font-weight:bold; font-size:16px;"><?php echo stripslashes($r[$i]['titre']); ?></strong></a>
        </h3>
        <?php echo $func->fDate(substr($r[$i]["publie"], 0, 10)) ?><br>
        
        </div><?php 
        
        0