Afficher un table sql

iris -  
 iris -
Bonjour,
bon salut à tous ..
j'ai un probleme daffichage j'ai créer ma base et 2 TABLEAU pour un forum
linsertion dans ces tableux bien effectuée
mais lorsque je les affiche rien à retourn !!
voici le script



// Connect to server and select databse.
$id_connexion=mysql_connect('localhost','root','') or die('Probl? de connexion au serveur MYSQL!');
mysql_select_db('base',$id_connexion) or die('Probl? de selection de la base de donn?!');
$sql="SELECT * FROM $tbl_name ORDER BY id DESC";
// OREDER BY id DESC is order result by descending

$result=mysql_query($sql);
?>

<table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td width="6%" align="center" bgcolor="#E6E6E6"><strong>#</strong></td>
<td width="53%" align="center" bgcolor="#E6E6E6"><strong>Titre</strong></td>
<td width="15%" align="center" bgcolor="#E6E6E6"><strong>Views</strong></td>
<td width="13%" align="center" bgcolor="#E6E6E6"><strong>Locataires</strong></td>
<td width="13%" align="center" bgcolor="#E6E6E6"><strong>Date/Time</strong></td>
</tr>

<?php

// Start looping table row
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td bgcolor="#FFFFFF"><? echo $rows['id']; ?></td>
<td bgcolor="#FFFFFF"><a href="?p=view_top?id=<? echo $rows['id']; ?>"><? echo $rows['topic']; ?></a><BR></td>
<td align="center" bgcolor="#FFFFFF"><? echo $rows['view']; ?></td>
<td align="center" bgcolor="#FFFFFF"><? echo $rows['reply']; ?></td>
<td align="center" bgcolor="#FFFFFF"><? echo $rows['datetime']; ?></td>
</tr>

<?php
// Exit looping and close connection
}
mysql_close();
?>

2 réponses

  1. Pitet Messages postés 2845 Statut Membre 530
     
    Salut,

    Où est définie la variable $tbl_name ?

    Bonne journée,
    0
    1. iris
       
      $tbl_name="forum_question"; // Table name
      voila
      0
  2. jordane45 Messages postés 30427 Date d'inscription   Statut Modérateur Dernière intervention   4 831
     
    Bonjour,

    De plus... attention ... tu utilises l'ancienne extension mysql.
    https://www.commentcamarche.net/faq/43261-php-l-extension-mysql-est-obsolete#top

    Il serait temps de passer à Mysqli ou à la PDO.....

    0
    1. iris
       
      merci bcp ♥
      0