Aide - Recherche - Membres - Calendrier
Version complète : Plusieurs résultat mysql ......
Forum Webmaster - Ton Webmaster > Conception de sites > Programmation > MySql
flightsim
Bonjour





J'ai fais un petit annuaire de lien(php/mysql) pour mon site

ces resultat je veut qu'il soit classer dans un tableau pour chaque lien



Voila le tableau et le code (par exemple si il y a 5 lien dans le base il y aura 5 tableau...)



CODE
<?php





Include("config.php");





$Sql ="select lien,description,banniere,titre,id from lienfs order by id desc";


$requete = mysql_query($Sql);





while($j = mysql_fetch_array($requete))


{


   $lien = $j[lien];


   $description = $j[description];


   $banniere = $j[banniere];


   $titre = $j[titre];


   $id = $j[id];





}


mysql_close();  


?>





<table border="1" width="78%">


 <tr>


   <td width="100%">


     <p align="center"><?php echo $titre ?></td>


 </tr>


 <tr>


   <td width="100%"><img border="0" src="<?php echo $banniere ?>"></td>


 </tr>


 <tr>


   <td width="100%"><?php echo $description ?></td>


 </tr>


 <tr>


   <td width="100%">


     <p align="center"><a href="<?php echo $lien ?>" target="_blank">Visiter


     ce site</a></td>


 </tr>


</table>






Mais quand il y a 2 enregisterment il m'en montre que un enregistrement sur un seul tableau

Et moi je veut que si il y a deux enregistrement il m'affiche deux tableau avec ces enregistrement bien sur



merci
Nitro83
bin c'est sur réfléchi ... si tu es dans une boucle et tu fais un tableau quand il lira le résulktat si yen a plus que 1 il créera deux tables,n fait un tableau avant la boucle ...



<?php



Include("config.php");



$Sql ="select lien,description,banniere,titre,id from lienfs order by id desc";

$requete = mysql_query($Sql);

echo "<table border="1" width="78%">";

while($j = mysql_fetch_array($requete))

{

$lien = $j[lien];

$description = $j[description];

$banniere = $j[banniere];

$titre = $j[titre];

$id = $j[id];



?>

<tr>

<td width="100%">

<p align="center"><?php echo $titre ?></td>

</tr>

<tr>

<td width="100%"><img border="0" src="<?php echo $banniere ?>"></td>

</tr>

<tr>

<td width="100%"><?php echo $description ?></td>

</tr>

<tr>

<td width="100%">

<p align="center"><a href="<?php echo $lien ?>" target="_blank">Visiter

ce site</a></td>

<?

}

mysql_close();

?>

</tr>

</table>







[ita]*** Message édité par Nitro83 le 19/10/2004 19:48 ***[/ita]
flightsim
merci







j'ai essayer ton code mais il me marque :



Parse error: parse error, expecting `','' or `';'' in /data/members/free/multimania/fr/f/l/i/flightsimu01/htdocs/lienfs.php on line 7



merci
Nitro83
lol merde oublier de remplacer les tableLOL

enleve tous les " du echo ou met : table width"truc" voila, javais oublier :xd





[ita]*** Message édité par Nitro83 le 19/10/2004 21:12 ***[/ita]
flightsim
merci ça marche !!!!!!!

heu mes tableau son coller tu peut me dire ou je doit mettre le <br> merci
Nitro83
coller c'est a dire?
flightsim
entre 2 tableau il y a pas d'espace
Nitro83
ca c du html cellpading cellspacing etc
flightsim
cellpading ??

c'est quoi
stevelace
"cellpadding" est le paramètre qui définit l'espace autour du texte d'une cellule.



EX: <table width="100" border="0" cellspacing="0" cellpadding="5">
flightsim
Merci mais je sias pas ou le placez



mais j'ai trouvez ça marche grace au siteduzero.com !!



ps mon code :



CODE
<?php





Include("config.php");








$retour = mysql_query('SELECT * FROM lienfs ORDER BY id DESC');


while ($donnees = mysql_fetch_array($retour))


{


?>


<br>


<table border="1" width="78%">


<tr>


   <td width="100%">


     <p align="center"><? echo $donnees['titre']; ?></td>


 </tr>


 <tr>


   <td width="100%"><img border="0" src="<? echo $donnees['banniere']; ?>"></td>


 </tr>


 <tr>


   <td width="100%"><?


$description = nl2br(stripslashes($donnees['description']));


echo $description;


?>


</ ?></td>


 </tr>


 <tr>


   <td width="100%">


     <p align="center"><a href="<? echo $donnees['url']; ?>" target="_blank">Visiter


     ce site</a></td>


 </tr>


</table>





<?


}


?>
C\'est une version "bas débit" de notre forum. Pour voir la version complète avec plus d\'information, la mise en page et les images, veuillez cliquez ici.
Invision Power Board © 2001-2012 Invision Power Services, Inc.