Visualizzazione dei risultati da 1 a 4 su 4

Discussione: ultimi 5 thread su IPB

  1. #1

    ultimi 5 thread su IPB

    ho un problema. con il seguente codice non riesco a visualizzare gli ultimi 5 thread del mio forum IPB. cosa c'è che non va?

    Codice PHP:
    <?php
    /*
    +--------------------------------------------------------------------------+
    |   Show topic script                                                         |
    |   ========================================                               | 
    |   author: Trashofmasters                                                 |
    |   ========================================                               |
    +--------------------------------------------------------------------------+
    |   ========================================                               |
    |   this software is distribuited under                                    |                          
    |   the GNU-GPL license                                                    |
    |   ========================================                               |
    |                                                                          |
    +--------------------------------------------------------------------------+
    |                     Invision power board 1.3                             |
    +--------------------------------------------------------------------------+
    */

    //topic show limit 
    $limit 5;

    //Forum directory
    define(FORUM_PATH,'upload/');

    //require the configuration file
    include(FORUM_PATH.'conf_global.php');

    //connect to the forum database
         
    $conn mysql_connect($INFO['sql_host'],$INFO['sql_user'],$INFO['sql_pass']) or die('error during the database connection');    
         
    $db mysql_select_db($INFO['sql_database'], $conn) or die('error during the database connection');
         
    //select the last topics limit by $limit 
         
    $query  "SELECT * FROM `" .$INFO['sql_tbl_prefix']. "topics` WHERE `state`='open' ORDER BY `tid` DESC LIMIT $limit";
         
    $select mysql_query($query);
         echo 
    '<table width="300" border="0" cellspacing="0" cellpadding="0" class="tab">
              <tr>
                <td width="300">Ulimi thread </td>
              </tr>'
    ;
         while (
    $threads mysql_fetch_array($select))
         {
         echo
    '<tr>
                <td width="300" class="content">» [url="'
    ,FORUM_PATH,'index.php?showtopic=',$threads['tid'],'"]',$threads['title'],'[/url]
                </td>
            </tr>'
    ;
         }
         echo 
    "</table>";
         
    ?>
    raindown

  2. #2
    Utente di HTML.it
    Registrato dal
    Jan 2007
    Messaggi
    595
    Che intendi con "non riesce"?
    Non ne vedi nessuno?
    Non vedi alcuni?
    Ne vedi 5 ma non sono gli ultimi?

  3. #3
    intendo che non visualizza nulla
    raindown

  4. #4
    Utente di HTML.it
    Registrato dal
    Jan 2007
    Messaggi
    595
    di solito in questi casi faccio così
    Codice PHP:
    $query  "SELECT * FROM `" .$INFO['sql_tbl_prefix']. "topics` 
    WHERE `state`='open' ORDER BY `tid` DESC LIMIT 
    $limit"
    echo 
    $query
    Prendo quello che esce sullo schermo, lo copio e incollo su "phpmyadmin" e vedo cosa viene fuori
    Il 104% delle volte è un errore nel query

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.