Eléphant du PHP |
113 Messages
18 avr. 2006, 22:34
J'ai épuré un max ce script:
<?php
$result = mysql_query(" SELECT citateurs_celebres.nom, citateurs_celebres.prenom, citations_celebres.citation, citations_celebres.id
FROM citateurs_celebres LEFT JOIN citations_celebres ON citateurs_celebres.id = citations_celebres.numcitateur
ORDER BY rand()
LIMIT 0, 5");
while ($donnees =mysql_fetch_array ($result) )
{
// affiche les different champs
echo $donnees['citation'];?>
<a href="#" onclick="window.open('envoi_cit/formulaire.php?id_article=<?php echo $donnees['citation']; ?>','_blank','toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, copyhistory=0, menuBar=0, width=400, height=270');"><img src="images/envoyer.gif" alt="envoyez cette citation à un ami !" border="0" align="absmiddle" /></a>
<?php
echo $donnees['prenom'];
echo $donnees['nom'];
echo"<br /> <br />";
}
?>
Alors qu'en refaisant un affichage normal comme ceci, ça marche
<?php
$reponse = mysql_query("SELECT citateurs_celebres.nom, citateurs_celebres.prenom, citations_celebres.citation FROM citateurs_celebres LEFT JOIN citations_celebres ON citateurs_celebres.id = citations_celebres.numcitateur ORDER BY rand() LIMIT 0, 5");
echo mysql_error();
// On fait une boucle pour lister tout ce que contient la table :
while ($donnees = mysql_fetch_array($reponse) )
{
?>
<p>
<?php echo $donnees['citation']; ?><br />
<a href="#" onclick="window.open('envoi_cit/formulaire.php?id_article=<?php echo $donnees['citation']; ?>','_blank','toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, copyhistory=0, menuBar=0, width=400, height=270');"><img src="images/envoyer.gif" alt="envoyez cette citation à un ami !" border="0" align="absmiddle" /></a>
<span <?php echo $donnees['prenom']; ?> <?php echo $donnees['nom']; ?>