Voila je voudrai utiliser un systeme de mail automatique mais j'aimerai tout d'abord recuperer le mail dans une base de données et le mettre dans la variable $dest. Le probleme c'est que lorsque je fais un echo $dest il me met "ressource id #6".Les requetes sont testes et fonctionne.Merci de vos reponses

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
</head>
 
<body>
<?php
 
include("connexion.php");
include("lib_sql.php");
$requete="select t_clt.k_clt,nom,prenom,mail,k_commande
from t_commandes, t_clt
where t_clt.k_clt = t_commandes.k_clt and etat='nouvelle' and status='finalisee'
order by k_clt"; 
$result= mysql_query($requete); 
if(!$result)
{
  echo "Lecture impossible"; 
}
else
{
    $nbcol=mysql_num_fields($result); 
    $nbemail=mysql_num_rows($result); 
    echo "<h3> Tous nos e-mail enregistres</h3>";
    echo "<h4> Il y a $nbemail nouvelles commandes enregistre </h4>";
    echo "<table border=\"1\"><tbody>";
    echo "<tr><th>No client</th> <th>Nom</th> <th>Prenom</th> <th>Mail</th><th>No commande</th></tr>";
    while($ligne=mysql_fetch_array($result,MYSQL_NUM)) 
    {
    echo "<tr>";
    foreach($ligne as $valeur) 
    {
      echo "<td> $valeur </td>";
    }
        echo "</tr>";
    }
    echo "</tbody></table>";
}
mysql_free_result($result);
 
$dest = "";
$requete2="select mail from t_commandes, t_clt where t_clt.k_clt = t_commandes.k_clt and etat='nouvelle' and status='finalisee'";
 
$dest =  mysql_query($requete2); 
$html = "<html>
<body>
blabla
</body>
</html>";
 
	if(mail("$dest","Test mail", "$html"))
	{
		echo "Envoi reussi";
	}
	else
	{
		echo "$dest";
	}
 
?>
</body>
</html>