Codice PHP:
<?php include 'template/top_template.php'; if (isset($_GET['id'])) { include 'inc/config.php'; Connetti(); $query = "SELECT * FROM $tab_topics WHERE id = " .$_GET['id']; $ris = mysql_query($query) or die(mysql_error()); $fetch = mysql_fetch_assoc($ris); ?> <?php /*AMMINISTRAZIONE*/ if (session_is_registered(Amministratore)) { ?> <div id="gestione_topic"> <button onClick="window.location = 'edit_topic.php?id=<?php echo $fetch['id']; ?>'" >Modifica Topic</button> <button onClick="window.location = 'delete_topic.php?id=<?php echo $fetch['id']; ?>'" >Elimina Topic</button> <button onClick="window.location = 'close_topic.php?id=<?php echo $fetch['id']; ?>'" >Chiudi Topic</button> </div> <?php } ?> <div id="borderwrap"> <div class="maintitle"> [url="show_topic.php?id=<?php echo $fetch['id'] ?>"]<?php echo $fetch['titolo'] ?>[/url] </div> <table class="mostra_topic" cellspacing="1"> <tbody> <tr> <td valign="middle" class="info_user" width="1%">[img]images/user_icon2.png[/img]<?php echo $fetch['autore'] ?></td> <td class="row2" valign="middle" width="99%"><?php echo $fetch['data'] ?></td> </tr> <tr> <td valign="top" class="post2">[img]images/default.jpg[/img]</td> <td width="100%" valign="top" class="post2" id="post_main"> <div class="user_post"> <?php echo nl2br($fetch['contenuto'])?> </div> </td> </tr> <tr> <td class="formbuttomrow" nowrap="nowrap"></td> <td class="formbuttomrow" nowrap="nowrap"></td> </tr> <tr> <td class="catend" colspan="2"></td> </tr> </tbody> </table> </div> <hr class="dividi"/> <?php if ($fetch['chiuso'] != 0) { ?> <font style="color:#F00;border:1px solid #F00;">Discussione Chiusa</font> <?php } else { ?> <div id="user_button"> [url="<?php echo "]">[/url] </div> <?php } $query1 = "SELECT * FROM $tab_commenti WHERE id_topic = " . $_GET['id'] . " ORDER BY id_commento"; $ris1 = mysql_query($query1) or die(mysql_error()); while ($fetch1 = mysql_fetch_assoc($ris1)) { ?> <div id="borderwrap"> <div class="maintitle">
Commento</p> </div> <table class="mostra_topic" cellspacing="1"> <tbody> <tr> <td valign="middle" class="info_user" width="1%">[img]images/user_icon2.png[/img]<?php echo $fetch1['autore'] ?></td> <td class="row2" valign="middle" width="99%"><?php echo $fetch1['data'] ?></td> </tr> <tr> <td valign="top" class="post2">[img]images/01.jpg[/img]</td> <td width="100%" valign="top" class="post2" id="post_main"> <div class="user_post"> <?php echo nl2br($fetch1['messaggio']); ?> </div> </td> </tr> <tr> <td class="formbuttomrow" nowrap="nowrap"></td> <td class="formbuttomrow" nowrap="nowrap"></td> </tr> <tr> <td class="catend" colspan="2"></td> </tr> </tbody> </table> </div> <?php } } else { echo "Nessun topic trovato!"; } include 'template/bottom_template.php'; ?>
Questo e lo show thread ... se volessi stampare gli avatar relativi a quei utenti dovrei fare un fetch_assoc()?