Précédent   Forum des professionnels en informatique > PHP > Langage > Syntaxe
Syntaxe Forum d'entraide sur la syntaxe de PHP et la POO. Avant de poster -> FAQ syntaxe, Cours d'initiation et cours de POO
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 21/02/2011, 00h29   #1
Membre confirmé
 
Inscription : mars 2004
Messages : 1 187
Détails du profil
Informations forums :
Inscription : mars 2004
Messages : 1 187
Points : 233
Points : 233
Par défaut Parse error: syntax error

Bonjour à tous,

je tente d'envoyer un mail en effectuant une requête

Code :
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
 
 
	$envoi_mail->Body='<html>
	<head>
		<title>'.$txt0235.'</title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<style type="text/css">
 
 
.global
{
margin-left:200px;
width:610px;
background-color:white;
}
 
		</style> 
	</head>
	<body bgcolor="#EFEFEF" text="#000000">
 
	<div class="global">
 
	<a href="'.$site.'index.php">
	<div class="banniere">
	</div>
	</a>
 
	<div class="content">
 
	<br />
 
	<br /><br />'
 
	$sqla = sprintf("SELECT A.id_adh, A.id_vil, A.date_ins, B.id_vil, B.id_pay, B.ville_fr, C.id_pay, C.id_con, C.pays_".$lang.", D.cont_".$lang."
	FROM flatforswap_adherent A
	INNER JOIN flatforswap_ville B ON A.id_vil = B.id_vil
	INNER JOIN flatforswap_pays C ON B.id_pay = C.id_pay 
	INNER JOIN flatforswap_continent D ON D.id_con = C.id_con
	WHERE A.valide ='2' AND (A.date_ins BETWEEN '2010-10-18' AND '2011-01-30') ORDER BY ville DESC");
j'ai une erreur au niveau de la ligne

Code :
1
2
3
 
 
$sqla = sprintf("SELECT A.id_adh, A.id_vil, A.date_ins, B.id_vil, B.id_pay, B.ville_fr, C.id_pay, C.id_con, C.pays_".$lang.", D.cont_".$lang."
avec le message suivant

Parse error: syntax error, unexpected T_VARIABLE in /home/swapnfly/public_html/mail-news-membres.php on line 122


Merci d'avance pour votre aide.
sam01 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/02/2011, 09h14   #2
Modérateur
 
Avatar de sabotage
 
Homme Vincent
Inscription : juillet 2005
Messages : 14 929
Détails du profil
Informations personnelles :
Nom : Homme Vincent

Informations forums :
Inscription : juillet 2005
Messages : 14 929
Points : 16 381
Points : 16 381
Il manque un point virgule a la ligne au dessus.
sabotage est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/02/2011, 18h56   #3
Membre confirmé
 
Inscription : mars 2004
Messages : 1 187
Détails du profil
Informations forums :
Inscription : mars 2004
Messages : 1 187
Points : 233
Points : 233
Bonjour Sabotage et merci. Heu j'ai un peu honte de ne pas avoir vu ça.

Mais mon envoi de mail ne fonctionne toujours pas...

voici le code en entier :

Code :
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
 
 
	$envoi_mail->Body='<html>
	<head>
		<title>'.$txt0235.'</title>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<style type="text/css">
 
 
.global
{
margin-left:200px;
width:610px;
background-color:white;
}
 
 
.banniere
{
width:600px;
height:72px;
border:none;
background-image: url(\'http://www.swapnfly.com/images/banniere/banniere_finale_mail.png\');
}
 
	<br />
 
	<br /><br />';
 
	$sqla = sprintf("SELECT A.id_adh, A.id_vil, A.date_ins, B.id_vil, B.id_pay, B.ville_fr, C.id_pay, C.id_con, C.pays_".$lang.", D.cont_".$lang."
	FROM flatforswap_adherent A
	INNER JOIN flatforswap_ville B ON A.id_vil = B.id_vil
	INNER JOIN flatforswap_pays C ON B.id_pay = C.id_pay 
	INNER JOIN flatforswap_continent D ON D.id_con = C.id_con
	WHERE A.valide ='2' AND (A.date_ins BETWEEN '2010-10-18' AND '2011-01-30') ORDER BY ville DESC");
 
	if ($reqa) {
	while($dataa = mysql_fetch_assoc($reqa)){
	$id_adh = $dataa['id_adh'];
 
	// requête pour déterminer les photos
 
	$sqlc = sprintf("SELECT A.id_adh, B.id_adh, B.id_log, C.id_log, C.up_nom 
			FROM flatforswap_adherent A
			INNER JOIN flatforswap_logement B ON A.id_adh = B.id_adh
			INNER JOIN flatforswap_photo C ON B.id_log = C.id_log
			WHERE A.id_adh=%s", quote_smart($id_adh));
			$reqc = mysql_query($sqlc) or die('Erreur SQL : <br />'.$sqlc);
			$nbr_photo = mysql_num_rows($reqc);
 
			if($nbr_photo == '0'){
			echo '<a href="'.$site.'profiladh-logement-etudiant-'.$id_adh.'.html"><img class="image_part" src="'.$site.'/images/photo/photo_no.gif" width="50" height="50" alt=""></a>';}
			else{
			echo '<a href="'.$site.'profiladh-logement-etudiant-'.$id_adh.'.html"><img class="image_part" src="'.$site.'/images/photo/'.$id_adh.'/mini/'.$datac['up_nom'].'" width="50" height="50" alt=""></a>';}
 
			// requête pour déterminer la localité de l'adhérent et le nombre de couchage
			$sqlb = sprintf("select X.id_adh, X.id_vil, A.id_vil, A.id_pay, A.ville_fr, B.id_pay, B.id_con, B.pays_".$lang.", C.id_con, C.cont_".$lang.", E.id_adh, E.pers
			FROM flatforswap_adherent X
			INNER JOIN flatforswap_ville A ON X.id_vil = A.id_vil
			INNER JOIN flatforswap_pays B ON A.id_pay = B.id_pay
			INNER JOIN flatforswap_continent C ON B.id_con = C.id_con
			INNER JOIN flatforswap_logement E ON X.id_adh = E.id_adh
			WHERE X.id_adh=%s", quote_smart($id_adh));
			$reqb = mysql_query($sqlb) or die('Erreur SQL !<br>'.$sqlb.'<br>'.mysql_error());
			$datab = mysql_fetch_assoc($reqb);
			$ville_adh = $datab['ville_fr'];
			$pays_adh = $datab['pays_'.$lang.''];
			$continent_adh = $datab['cont_'.$lang.''];
			$pers_adh = $datab['pers'];
 
			// permet de déterminer le type de logement
 
			$sqld = sprintf("SELECT A.id_adh, B.id_log, B.id_adh, B.description, B.type, B.pers
			FROM flatforswap_adherent A
			INNER JOIN flatforswap_logement B ON A.id_adh = B.id_adh
			WHERE A.id_adh=".$id_adh);
			if($datad['type'] == "0"){
			$type_app = $idem_txt0060;}
			else{
			$type_app = $idem_txt0061;}
 
 
 
			echo $continent_adh.' / '.$pays_adh.' / '.$ville_adh.
			'<br />'
			.$type_app.			
		    '<br />'
			.$pers_adh.' &nbsp '.$txt0306.
 
	'<div class="spacer">
	</div>
 
 
	<br /><br />';}}
 
	echo '</div>
 
	<div class="footer">
 
	<div class="foot_g">
	</div>
 
	<div class="foot_m">
 
	<h1 style="font-size:1px;"> &nbsp </h1>
 
	<a href="'.$site.'condition-'.$lang.'.php">'.$idem_txt0209.'</a> | <a href="'.$site.'contact.php">'.$idem_txt0208.'</a>
 
	</div>
 
	<div class="foot_d">
	</div>
 
 
	</div>
 
	</div>
 
 
	</body>
</html>';
Le mail est bien envoyé mais rien n'apparaît après la ligne :

Code :
1
2
3
4
5
6
 
 
 
	<br />
 
	<br /><br />';
Là ou j'ai ajouté le ; au fait...

Merci d'avance pour votre aide.
sam01 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/02/2011, 19h11   #4
Modérateur
 
Avatar de sabotage
 
Homme Vincent
Inscription : juillet 2005
Messages : 14 929
Détails du profil
Informations personnelles :
Nom : Homme Vincent

Informations forums :
Inscription : juillet 2005
Messages : 14 929
Points : 16 381
Points : 16 381
Il manque l'execution de la requête.
sabotage est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/02/2011, 19h14   #5
Rédacteur/Modérateur
 
Avatar de andry.aime
 
Homme Andry Aimé
Inscription : septembre 2007
Messages : 5 126
Détails du profil
Informations personnelles :
Nom : Homme Andry Aimé
Localisation : Ile Maurice

Informations forums :
Inscription : septembre 2007
Messages : 5 126
Points : 7 270
Points : 7 270
Bonsoir,

A la place des echo, tu dois faire une concaténation avec le body de ton mail.
exemple
Code :
1
2
3
4
if($nbr_photo == 0){
			$envoi_mail->Body.='<a href="'.$site.'profiladh-logement-etudiant-'.$id_adh.'.html"><img class="image_part" src="'.$site.'/images/photo/photo_no.gif" width="50" height="50" alt=""></a>';}
			else{
			$envoi_mail->Body.='<a href="'.$site.'profiladh-logement-etudiant-'.$id_adh.'.html"><img class="image_part" src="'.$site.'/images/photo/'.$id_adh.'/mini/'.$datac['up_nom'].'" width="50" height="50" alt=""></a>';}
A+
andry.aime est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 22/02/2011, 14h28   #6
Membre confirmé
 
Inscription : mars 2004
Messages : 1 187
Détails du profil
Informations forums :
Inscription : mars 2004
Messages : 1 187
Points : 233
Points : 233
OK merci à vous deux. Il manquait l'exécution de la requête et la concaténation.

Super.

Ca fonctionne.
sam01 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 12h44.


 
 
 
 
Partenaires

Hébergement Web