Probléme do while dans la fonction mail

Résolu/Fermé
salimdrame Messages postés 70 Date d'inscription lundi 7 avril 2008 Statut Membre Dernière intervention 24 juin 2011 - 24 mai 2010 à 16:33
salimdrame Messages postés 70 Date d'inscription lundi 7 avril 2008 Statut Membre Dernière intervention 24 juin 2011 - 24 mai 2010 à 19:56
Bonjour,

Je cherche à récupérer des valeurs stockées dans la BDD à travers un do while puis d'envoyer les valeurs de la boucle à l'aide de la fonction mail à une adresse précise.

par exemple :

------------------------ PHP ----------------------------

//Je récupére les données à partir de la table

$check_composition_commande = mysql_query("SELECT * FROM table_commandes WHERE link_order = '$link_order'") or die ("Impossible de trouver les détails de la commande ".mysql_error());

do
{
$commande_client="
<tr>
<td width=\"100\" align=\"center\">".$composition_commande['nbr_item']." </td>
<td> ".$composition_commande['nom_item']."</td>
<td width=\"100\" align=\"center\"> ".$composition_commande['price_item']*$composition_commande['nbr_item']."f CFA </td>
</tr>
";
}
while($composition_commande = mysql_fetch_array($check_composition_commande));



//Plus loin dans la fonction mail
//On envoie un mail au Restaurant
$titre = 'NOUVELLE COMMANDE CLIENT';

$e_mail = $mail_restaurant;

$contenu = '


<div style=\'width:600px; text-align:left; margin:20px auto; padding:10px 0; font-size:18px; font-weight:bold;\'>
'.$nbr_item_commande.' éléments commandé
</div>


<table width=\'600\' align=\'center\'>
<tr style=\'font-weight:bold;\'>
<td>Qte</td>
<td>Désignation</td>
<td>Prix</td>
</tr>

'.$commande_client.'

</table>


';
$chaine = stripslashes($contenu);

// envoi du mail HTML
$from = "From: Site web <orders@site_web.com>\nMime-Version:";
$from .= " 1.0\nContent-Type: text/html; charset=utf-8\n";
// envoie du mail
mail($e_mail,$titre,$chaine,$from);

-----------------------------------------------------------

Mon problème est que je ne reçois que les informations du premier élément de la commande peu importe le nombre d'éléments commandés.

Merci d'avance

A voir également:

3 réponses

avion-f16 Messages postés 19246 Date d'inscription dimanche 17 février 2008 Statut Contributeur Dernière intervention 21 avril 2024 4 497
24 mai 2010 à 18:57
Fais comme ça pour ajouter du texte à ta variable :
$variable .= 'Nouveau texte';
1
salimdrame Messages postés 70 Date d'inscription lundi 7 avril 2008 Statut Membre Dernière intervention 24 juin 2011 1
24 mai 2010 à 18:44
Un petit Up ^
0
salimdrame Messages postés 70 Date d'inscription lundi 7 avril 2008 Statut Membre Dernière intervention 24 juin 2011 1
24 mai 2010 à 19:56
Parfait!
Comme quoi, un insignifiant point peu faire la différence.
Merci
0