Aller au menu - Aller au contenu

Intégration publicité dans tableau dynamique

Pour accéder à cette section
Connectez-vous !
connexion_rpx

Résolu Le problème de ce sujet a été résolu

Offre d'emploi : Développeur Web PHP/Drupal (H/F)

Page 1 
Auteur Message
1 visiteur sur ce sujet (1 Anonyme)
Page 1 
Hors ligne cofloma # Posté le 08/02/2012 à 15:05:55

Bonjour,

A partir d'une base de donnée, je génére des tableaux dynamiques. Ces tableaux (avec plusieurs colonnes) peuvent atteindre plusieurs centaines de lignes en fonction de la requête
Je souhaite intégrer dans ces tableaux tous les 20 ou 30 lignes une ligne pour de la publicité. Cette ligne fusionnerait l'ensemble des colonnes.
Pouvez-vous m'indiquer si ma demande est réalisable?

Merci pour votre support
Publicité # Posté le 08/02/2012 à 15:05:55

Hors ligne philodick # Posté le 08/02/2012 à 16:08:20
Avatar

Pour faire court : oui.
Hors ligne cofloma # Posté le 08/02/2012 à 16:27:17


Très bonne nouvelle. Existe-t-il un tuto qui pourrait m'aiguiller pour modifier mon code afin d'obtenir cette fonctionnalité? si la réponse est positive, merci de bien vouloir me donner le lien
Hors ligne philodick # Posté le 08/02/2012 à 16:30:43
Avatar

Montre juste comment tu récupères les données de ta BDD, on doit pouvoir adapter facilement.
Hors ligne cofloma # Posté le 08/02/2012 à 17:10:09

Code : PHP
  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
122
123
124
125
<?php
if(isset($_POST['choix']) AND count($_POST['choix']) > 0 AND count($_POST['choix']) <= 5){
 $req = mysql_query("SELECT A.nom_produit, B.nom_support_euro, B.frais_gestion_euro, A.nom_assureur, A.nom_distributeur, A.fiscalite, A.type, A.commercialisation, B.2006, B.2007, B.2008, B.2009, B.2010, B.2011, A.logo_assureur, A.logo_distributeur FROM nom_support_euro B, tx_rendement A WHERE A.nom_produit=B.nom_produit AND A.nom_produit IN('".implode('\',\'', array_map('mysql_real_escape_string', $_POST['choix']))."') ORDER BY nom_produit ASC");
 
 echo '<form action="" method="post"><table class="sortable" id="tableau_contrats_en_euros">'."\n"; 
 echo '<center><table class="sortable" id="tableau_contrats_en_euros">'."\n"; 
echo'<caption>Rendements des Contrats</caption>'."\n";  
echo '<tr>'; 
echo '<th><b>Produit</b></td>'; 
echo '<th></th>'; 
echo '<th><b>Distributeur</b></td>'; 
echo '<th><b>Assureur</b></td>'; 
echo '<th><b>Fisacalité</b></td>'; 
echo '<th><b>Support €uro</b></td>'; 
echo '<th><b>Rendement 2009</b></td>'; 
echo '<th><b>Rendement 2010</b></td>'; 
echo '<th><b>Rendement 2011</b></td>'; 
echo '</tr>'."\n"; 

 while($row = mysql_fetch_assoc($req))
{ 
	echo '<tr>'; 
	echo '<td bgcolor="white"><b><font size="1"><a href="../contrat.php?nom='.$row['nom_produit'].'">'.$row["nom_produit" ].'</a></b></font></td>'; 
	if ($row['commercialisation'] == '')
		{
		echo '<td bgcolor="white"></td>';
		}
		else 
		{
		echo '<td bgcolor="white"><img src="../logos/interdit.png" alt="Plus commercialisé" title="Plus commercialisé" /> </td>';
		} 
if ($row['logo_distributeur'] == '')
{
echo '<td bgcolor="white">'.$row["nom_distributeur" ].'</td>';
}
else 
{
echo '<td bgcolor="white"><a href="../offres-distributeur.php?nom_distributeur='.$row['nom_distributeur'].'"><img src="../logos/tableaux/'. $row['logo_distributeur'].'" alt="'.$row["nom_distributeur" ].'" /></a></td>';
}
if ($row['logo_assureur'] == '')
{
echo '<td bgcolor="white">'.$row["nom_assureur" ].'</td>';
}
else 
{
echo '<td bgcolor="white"><a href="../offres-assureur.php?nom_assureur='.$row['nom_assureur'].'"><img src="../logos/tableaux/'. $row['logo_assureur'].'" alt="'.$row["nom_assureur" ].'" /></a></td>';
}
	echo '<td bgcolor="white">'.$row["fiscalite"].'</td>';
	if (($row['nom_support_euro'] == 'Fonds €uro') or ($row['nom_support_euro'] =='Actif Général'))
		{
		echo '<td>'.$row["nom_support_euro" ].'</td>'; 
		}
		else 
		{
		echo '<td><a href="../supports/euro.php?nom_support_euro='.$row['nom_support_euro'].'">'.$row["nom_support_euro" ].'</a></td>'; 
		} 
	echo '<td>'.$row["2009"].'</td>'; 
	echo '<td bgcolor="white">'.$row["2010"].'</td>'; 
	echo '<td>'.$row["2011"].'</td>'; 
	echo '</tr>'."\n"; 
} 
echo '<tr bgcolor="white"><td colspan="10"><a href="../caracteristiques/contrats-en-euros.php">Retour</a></td></tr>';
echo '</table></center>'."\n"; 
 }
else{
 if(isset($_POST['env']))
   echo '<div></div>';

$req = mysql_query("SELECT A.nom_produit, B.nom_support_euro, B.frais_gestion_euro, A.nom_assureur, A.nom_distributeur, A.fiscalite, A.type, A.commercialisation, B.2006, B.2007, B.2008, B.2009, B.2010, B.2011 FROM nom_support_euro B, tx_rendement A WHERE A.nom_produit=B.nom_produit and B.2011 <>('N/C' OR 'N/A' OR '') ORDER BY nom_produit ASC");

 echo '<form action="../caracteristiques/contrats-en-euros.php" method="post"><table class="sortable" id="tableau_contrats_en_euros">'."\n"; 
   echo 'Séléctionnez des contrats (maximum:5) pour en comparer les caractéristiques';

  
 echo'<caption>Rendements des Contrats</caption>'."\n";  
 echo '<tr>';
  echo '<th>Contrat</th>';
	echo '<th></th>';
echo '<th><b>Distributeur</b></td>'; 
echo '<th><b>Assureur</b></td>'; 
echo '<th><b>Fiscalité</b></td>'; 
echo '<th><b>Support €uro</b></td>'; 
echo '<th><b>Rendement 2009</b></td>'; 
echo '<th><b>Rendement 2010</b></td>'; 
echo '<th><b>Rendement 2011</b></td>'; 
echo '<th>Choix</th>';
echo '</tr>'."\n"; 

while($row=mysql_fetch_array($req)) 
{ 
echo '<tr>'; 
echo '<td bgcolor="white"><b><font size="1"><a href="../contrat.php?nom='.$row['nom_produit'].'">'.$row["nom_produit" ].'</a></b></font></td>'; 
  if ($row['commercialisation'] == '')
{
echo '<td bgcolor="white"></td>';
}
else 
{
echo '<td bgcolor="white"><img src="../logos/interdit.png" alt="Plus commercialisé" title="Plus commercialisé" /> </td>';
} 
echo '<td>'.$row["nom_distributeur"].'</td>'; 
echo '<td bgcolor="white">'.$row["nom_assureur"].'</td>'; 
echo '<td>'.$row["fiscalite"].'</td>';
 if (($row['nom_support_euro'] == 'Fonds €uro') or ($row['nom_support_euro'] =='Actif Général'))
{
echo '<td bgcolor="white">'.$row["nom_support_euro" ].'</td>'; 
}
else 
{
echo '<td bgcolor="white"><a href="../supports/euro.php?nom_support_euro='.$row['nom_support_euro'].'">'.$row["nom_support_euro" ].'</a></td>'; 
} 

	echo '<td>'.$row["2009"].'</td>'; 
	echo '<td bgcolor="white">'.$row["2010"].'</td>'; 
	echo '<td>'.$row["2011"].'</td>'; 
	echo '<td bgcolor="white"><input type="checkbox" name="choix[]" value="'.$row['nom_produit'].'" /></td>';
echo '</tr>'."\n"; 

} 

echo '</table></center>'."\n"; 

echo '<center><th colspan="8"><input type="submit" name="env" value="Envoyer" /></th></center></form>';
 }
?>
Hors ligne philodick # Posté le 08/02/2012 à 18:39:38
Avatar

Par exemple pour une pub toutes les 20 lignes :
Code : PHP
 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
<?php
$i=1;
while($row=mysql_fetch_array($req)) 
{ 
echo '<tr>'; 
echo '<td bgcolor="white"><b><font size="1"><a href="../contrat.php?nom='.$row['nom_produit'].'">'.$row["nom_produit" ].'</a></b></font></td>'; 
  if ($row['commercialisation'] == '')
{
echo '<td bgcolor="white"></td>';
}
else 
{
echo '<td bgcolor="white"><img src="../logos/interdit.png" alt="Plus commercialisé" title="Plus commercialisé" /> </td>';
} 
echo '<td>'.$row["nom_distributeur"].'</td>'; 
echo '<td bgcolor="white">'.$row["nom_assureur"].'</td>'; 
echo '<td>'.$row["fiscalite"].'</td>';
 if (($row['nom_support_euro'] == 'Fonds €uro') or ($row['nom_support_euro'] =='Actif Général'))
{
echo '<td bgcolor="white">'.$row["nom_support_euro" ].'</td>'; 
}
else 
{
echo '<td bgcolor="white"><a href="../supports/euro.php?nom_support_euro='.$row['nom_support_euro'].'">'.$row["nom_support_euro" ].'</a></td>'; 
} 

	echo '<td>'.$row["2009"].'</td>'; 
	echo '<td bgcolor="white">'.$row["2010"].'</td>'; 
	echo '<td>'.$row["2011"].'</td>'; 
	echo '<td bgcolor="white"><input type="checkbox" name="choix[]" value="'.$row['nom_produit'].'" /></td>';
echo '</tr>'."\n"; 
if($i%20==0)
    {
/* tu insères ta pub */
    }
$i++;
} 
 ?>
Édité le 09/02/2012 à 11:28:29 par philodick
Hors ligne cofloma # Posté le 08/02/2012 à 21:34:08

Philodick,

Cela ne marche pas, il y a bien 2 modifications sur le code initial:
$i=1;(ligne 2)
et
if($i%20==0)
{
/* tu insères ta pub */
}
$i++
(lignes 32 à 36)

Hors ligne philodick # Posté le 08/02/2012 à 22:03:56
Avatar

Citation : cofloma
...Cela ne marche pas...

Mais encore ? Ca donne quoi ?
Hors ligne cofloma # Posté le 08/02/2012 à 22:30:01


Merci

le lien: http://www.cofloma.fr/contrats_assurance.php

Le code

Code : PHP
  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
122
123
124
125
126
127
128
129
130
131
<?php
if(isset($_POST['choix']) AND count($_POST['choix']) > 0 AND count($_POST['choix']) <= 5){
 $req = mysql_query("SELECT A.nom_produit, B.nom_support_euro, B.frais_gestion_euro, A.nom_assureur, A.nom_distributeur, A.fiscalite, A.type, A.commercialisation, B.2006, B.2007, B.2008, B.2009, B.2010, B.2011, A.logo_assureur, A.logo_distributeur FROM nom_support_euro B, tx_rendement A WHERE A.nom_produit=B.nom_produit AND A.nom_produit IN('".implode('\',\'', array_map('mysql_real_escape_string', $_POST['choix']))."') ORDER BY nom_produit ASC");
 
 echo '<form action="" method="post"><table class="sortable" id="tableau_contrats_en_euros">'."\n"; 
 echo '<center><table class="sortable" id="tableau_contrats_en_euros">'."\n"; 
echo'<caption>Rendements des Contrats</caption>'."\n";  
echo '<tr>'; 
echo '<th><b>Produit</b></td>'; 
echo '<th></th>'; 
echo '<th><b>Distributeur</b></td>'; 
echo '<th><b>Assureur</b></td>'; 
echo '<th><b>Fisacalité</b></td>'; 
echo '<th><b>Support €uro</b></td>'; 
echo '<th><b>Rendement 2009</b></td>'; 
echo '<th><b>Rendement 2010</b></td>'; 
echo '<th><b>Rendement 2011</b></td>'; 
echo '</tr>'."\n"; 

 while($row = mysql_fetch_assoc($req))
{ 
	echo '<tr>'; 
	echo '<td bgcolor="white"><b><font size="1"><a href="../contrat.php?nom='.$row['nom_produit'].'">'.$row["nom_produit" ].'</a></b></font></td>'; 
	if ($row['commercialisation'] == '')
		{
		echo '<td bgcolor="white"></td>';
		}
		else 
		{
		echo '<td bgcolor="white"><img src="../logos/interdit.png" alt="Plus commercialisé" title="Plus commercialisé" /> </td>';
		} 
if ($row['logo_distributeur'] == '')
{
echo '<td bgcolor="white">'.$row["nom_distributeur" ].'</td>';
}
else 
{
echo '<td bgcolor="white"><a href="../offres-distributeur.php?nom_distributeur='.$row['nom_distributeur'].'"><img src="../logos/tableaux/'. $row['logo_distributeur'].'" alt="'.$row["nom_distributeur" ].'" /></a></td>';
}
if ($row['logo_assureur'] == '')
{
echo '<td bgcolor="white">'.$row["nom_assureur" ].'</td>';
}
else 
{
echo '<td bgcolor="white"><a href="../offres-assureur.php?nom_assureur='.$row['nom_assureur'].'"><img src="../logos/tableaux/'. $row['logo_assureur'].'" alt="'.$row["nom_assureur" ].'" /></a></td>';
}
	echo '<td bgcolor="white">'.$row["fiscalite"].'</td>';
	if (($row['nom_support_euro'] == 'Fonds €uro') or ($row['nom_support_euro'] =='Actif Général'))
		{
		echo '<td>'.$row["nom_support_euro" ].'</td>'; 
		}
		else 
		{
		echo '<td><a href="../supports/euro.php?nom_support_euro='.$row['nom_support_euro'].'">'.$row["nom_support_euro" ].'</a></td>'; 
		} 
	echo '<td>'.$row["2009"].'</td>'; 
	echo '<td bgcolor="white">'.$row["2010"].'</td>'; 
	echo '<td>'.$row["2011"].'</td>'; 
	echo '</tr>'."\n"; 
} 
echo '<tr bgcolor="white"><td colspan="10"><a href="../caracteristiques/contrats-en-euros.php">Retour</a></td></tr>';
echo '</table></center>'."\n"; 
 }
else{
 if(isset($_POST['env']))
   echo '<div></div>';

$req = mysql_query("SELECT A.nom_produit, B.nom_support_euro, B.frais_gestion_euro, A.nom_assureur, A.nom_distributeur, A.fiscalite, A.type, A.commercialisation, B.2006, B.2007, B.2008, B.2009, B.2010, B.2011 FROM nom_support_euro B, tx_rendement A WHERE A.nom_produit=B.nom_produit and B.2011 <>('N/C' OR 'N/A' OR '') ORDER BY nom_produit ASC");

 echo '<form action="../caracteristiques/contrats-en-euros.php" method="post"><table class="sortable" id="tableau_contrats_en_euros">'."\n"; 
   echo 'Séléctionnez des contrats (maximum:5) pour en comparer les caractéristiques';

  
 echo'<caption>Rendements des Contrats</caption>'."\n";  
 echo '<tr>';
  echo '<th>Contrat</th>';
	echo '<th></th>';
echo '<th><b>Distributeur</b></td>'; 
echo '<th><b>Assureur</b></td>'; 
echo '<th><b>Fiscalité</b></td>'; 
echo '<th><b>Support €uro</b></td>'; 
echo '<th><b>Rendement 2009</b></td>'; 
echo '<th><b>Rendement 2010</b></td>'; 
echo '<th><b>Rendement 2011</b></td>'; 
echo '<th>Choix</th>';
echo '</tr>'."\n"; 

$i=1;
while($row=mysql_fetch_array($req)) 
{ 
echo '<tr>'; 
echo '<td bgcolor="white"><b><font size="1"><a href="../contrat.php?nom='.$row['nom_produit'].'">'.$row["nom_produit" ].'</a></b></font></td>'; 
  if ($row['commercialisation'] == '')
{
echo '<td bgcolor="white"></td>';
}
else 
{
echo '<td bgcolor="white"><img src="../logos/interdit.png" alt="Plus commercialisé" title="Plus commercialisé" /> </td>';
} 
echo '<td>'.$row["nom_distributeur"].'</td>'; 
echo '<td bgcolor="white">'.$row["nom_assureur"].'</td>'; 
echo '<td>'.$row["fiscalite"].'</td>';
 if (($row['nom_support_euro'] == 'Fonds €uro') or ($row['nom_support_euro'] =='Actif Général'))
{
echo '<td bgcolor="white">'.$row["nom_support_euro" ].'</td>'; 
}
else 
{
echo '<td bgcolor="white"><a href="../supports/euro.php?nom_support_euro='.$row['nom_support_euro'].'">'.$row["nom_support_euro" ].'</a></td>'; 
} 

	echo '<td>'.$row["2009"].'</td>'; 
	echo '<td bgcolor="white">'.$row["2010"].'</td>'; 
	echo '<td>'.$row["2011"].'</td>'; 
	echo '<td bgcolor="white"><input type="checkbox" name="choix[]" value="'.$row['nom_produit'].'" /></td>';
echo '</tr>'."\n"; 
if($i%20==0)
    {
/* tu insères ta pub */
    }
$i++
} 
} 

echo '</table></center>'."\n"; 

echo '<center><th colspan="8"><input type="submit" name="env" value="Envoyer" /></th></center></form>';
 }
?>
Hors ligne zkiller # Posté le 08/02/2012 à 22:34:29
Développeur web
Avatar

Normalement ça devrais fonctionner ( testé )

Édit :

Parse error: syntax error, unexpected '}' in /homez.324/coflomax/www/contrats_assurance.php on line 236

regarde alentour de la ligne indiqué dans l'erreur pour trouver un } de trop ou manquant.
Édité le 08/02/2012 à 22:38:40 par zkiller

Image utilisateur| URL Shortener
Up2Shares V2 en développement > recrute 1 graphiste et 1 codeur html5/css3
Apprenez à lire la doc s.v.p! :-°
 
Hors ligne cofloma # Posté le 08/02/2012 à 22:38:28

Le message:

Parse error: syntax error, unexpected '}' in /homez.324/coflomax/www/contrats_assurance.php on line 236
Hors ligne zkiller # Posté le 08/02/2012 à 22:39:17
Développeur web
Avatar

Si tu trouve pas... copie le fichier complet svp

Image utilisateur| URL Shortener
Up2Shares V2 en développement > recrute 1 graphiste et 1 codeur html5/css3
Apprenez à lire la doc s.v.p! :-°
 
Hors ligne philodick # Posté le 08/02/2012 à 22:45:28
Avatar

Il me semble que tu as mis une accolade de plus par rapport à mon code...
Hors ligne cofloma # Posté le 08/02/2012 à 23:00:40

Désolé je ne trouve pas : j'ai testé plusieurs solutions en particulier en enlevant l'accolade ligne 124 qui correspond à la ligne 236 dans le message d'erreur

Code : PHP
  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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?php
if(isset($_POST['choix']) AND count($_POST['choix']) > 0 AND count($_POST['choix']) <= 5){
 $req = mysql_query("SELECT A.nom_produit, B.nom_support_euro, B.frais_gestion_euro, A.nom_assureur, A.nom_distributeur, A.fiscalite, A.type, A.commercialisation, B.2006, B.2007, B.2008, B.2009, B.2010, B.2011, A.logo_assureur, A.logo_distributeur FROM nom_support_euro B, tx_rendement A WHERE A.nom_produit=B.nom_produit AND A.nom_produit IN('".implode('\',\'', array_map('mysql_real_escape_string', $_POST['choix']))."') ORDER BY nom_produit ASC");
 
 echo '<form action="" method="post"><table class="sortable" id="tableau_contrats_en_euros">'."\n"; 
 echo '<center><table class="sortable" id="tableau_contrats_en_euros">'."\n"; 
echo'<caption>Rendements des Contrats</caption>'."\n";  
echo '<tr>'; 
echo '<th><b>Produit</b></td>'; 
echo '<th></th>'; 
echo '<th><b>Distributeur</b></td>'; 
echo '<th><b>Assureur</b></td>'; 
echo '<th><b>Fisacalité</b></td>'; 
echo '<th><b>Support €uro</b></td>'; 
echo '<th><b>Rendement 2009</b></td>'; 
echo '<th><b>Rendement 2010</b></td>'; 
echo '<th><b>Rendement 2011</b></td>'; 
echo '</tr>'."\n"; 

 while($row = mysql_fetch_assoc($req))
{ 
	echo '<tr>'; 
	echo '<td bgcolor="white"><b><font size="1"><a href="../contrat.php?nom='.$row['nom_produit'].'">'.$row["nom_produit" ].'</a></b></font></td>'; 
	if ($row['commercialisation'] == '')
		{
		echo '<td bgcolor="white"></td>';
		}
		else 
		{
		echo '<td bgcolor="white"><img src="../logos/interdit.png" alt="Plus commercialisé" title="Plus commercialisé" /> </td>';
		} 
if ($row['logo_distributeur'] == '')
{
echo '<td bgcolor="white">'.$row["nom_distributeur" ].'</td>';
}
else 
{
echo '<td bgcolor="white"><a href="../offres-distributeur.php?nom_distributeur='.$row['nom_distributeur'].'"><img src="../logos/tableaux/'. $row['logo_distributeur'].'" alt="'.$row["nom_distributeur" ].'" /></a></td>';
}
if ($row['logo_assureur'] == '')
{
echo '<td bgcolor="white">'.$row["nom_assureur" ].'</td>';
}
else 
{
echo '<td bgcolor="white"><a href="../offres-assureur.php?nom_assureur='.$row['nom_assureur'].'"><img src="../logos/tableaux/'. $row['logo_assureur'].'" alt="'.$row["nom_assureur" ].'" /></a></td>';
}
	echo '<td bgcolor="white">'.$row["fiscalite"].'</td>';
	if (($row['nom_support_euro'] == 'Fonds €uro') or ($row['nom_support_euro'] =='Actif Général'))
		{
		echo '<td>'.$row["nom_support_euro" ].'</td>'; 
		}
		else 
		{
		echo '<td><a href="../supports/euro.php?nom_support_euro='.$row['nom_support_euro'].'">'.$row["nom_support_euro" ].'</a></td>'; 
		} 
	echo '<td>'.$row["2009"].'</td>'; 
	echo '<td bgcolor="white">'.$row["2010"].'</td>'; 
	echo '<td>'.$row["2011"].'</td>'; 
	echo '</tr>'."\n"; 
} 
echo '<tr bgcolor="white"><td colspan="10"><a href="../caracteristiques/contrats-en-euros.php">Retour</a></td></tr>';
echo '</table></center>'."\n"; 
 }
else{
 if(isset($_POST['env']))
   echo '<div></div>';

$req = mysql_query("SELECT A.nom_produit, B.nom_support_euro, B.frais_gestion_euro, A.nom_assureur, A.nom_distributeur, A.fiscalite, A.type, A.commercialisation, B.2006, B.2007, B.2008, B.2009, B.2010, B.2011 FROM nom_support_euro B, tx_rendement A WHERE A.nom_produit=B.nom_produit and B.2011 <>('N/C' OR 'N/A' OR '') ORDER BY nom_produit ASC");

 echo '<form action="../caracteristiques/contrats-en-euros.php" method="post"><table class="sortable" id="tableau_contrats_en_euros">'."\n"; 
   echo 'Séléctionnez des contrats (maximum:5) pour en comparer les caractéristiques';

  
 echo'<caption>Rendements des Contrats</caption>'."\n";  
 echo '<tr>';
  echo '<th>Contrat</th>';
	echo '<th></th>';
echo '<th><b>Distributeur</b></td>'; 
echo '<th><b>Assureur</b></td>'; 
echo '<th><b>Fiscalité</b></td>'; 
echo '<th><b>Support €uro</b></td>'; 
echo '<th><b>Rendement 2009</b></td>'; 
echo '<th><b>Rendement 2010</b></td>'; 
echo '<th><b>Rendement 2011</b></td>'; 
echo '<th>Choix</th>';
echo '</tr>'."\n"; 

$i=1;
while($row=mysql_fetch_array($req)) 
{ 
echo '<tr>'; 
echo '<td bgcolor="white"><b><font size="1"><a href="../contrat.php?nom='.$row['nom_produit'].'">'.$row["nom_produit" ].'</a></b></font></td>'; 
  if ($row['commercialisation'] == '')
{
echo '<td bgcolor="white"></td>';
}
else 
{
echo '<td bgcolor="white"><img src="../logos/interdit.png" alt="Plus commercialisé" title="Plus commercialisé" /> </td>';
} 
echo '<td>'.$row["nom_distributeur"].'</td>'; 
echo '<td bgcolor="white">'.$row["nom_assureur"].'</td>'; 
echo '<td>'.$row["fiscalite"].'</td>';
 if (($row['nom_support_euro'] == 'Fonds €uro') or ($row['nom_support_euro'] =='Actif Général'))
{
echo '<td bgcolor="white">'.$row["nom_support_euro" ].'</td>'; 
}
else 
{
echo '<td bgcolor="white"><a href="../supports/euro.php?nom_support_euro='.$row['nom_support_euro'].'">'.$row["nom_support_euro" ].'</a></td>'; 
} 

	echo '<td>'.$row["2009"].'</td>'; 
	echo '<td bgcolor="white">'.$row["2010"].'</td>'; 
	echo '<td>'.$row["2011"].'</td>'; 
	echo '<td bgcolor="white"><input type="checkbox" name="choix[]" value="'.$row['nom_produit'].'" /></td>';
echo '</tr>'."\n"; 
if($i%20==0)
    {
/* tu insères ta pub */
    }
$i++
} 
} 

echo '</table></center>'."\n"; 

echo '<center><th colspan="8"><input type="submit" name="env" value="Envoyer" /></th></center></form>';
 }
?>

<?php include("pub/zanox/hsbc-horizontal-grand.php"); ?> 

<?php include("pied_de_page.php");?></div>
   </body>
</html>
Hors ligne philodick # Posté le 09/02/2012 à 08:44:05
Avatar

M'enfin, tu vois bien que tu as une accolade fermante en trop (ligne 125 probablement).
Hors ligne cofloma # Posté le 09/02/2012 à 10:40:09

En retirant l'accolade en trop, cela ne marche pas. Il y a toujours un message d'erreur.
Je pense que le pb ce situe sur la ligne 123 ($i++), si je retire ce code, je n'ai plus de message d'erreur (mais je n'intégre toujours pas la pub). Qu'en penses-tu?
Hors ligne philodick # Posté le 09/02/2012 à 11:30:15
Avatar

Ah ouich, désolé, il manque un point-virgule, j'ai édité :
Code : PHP
  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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
if(isset($_POST['choix']) AND count($_POST['choix']) > 0 AND count($_POST['choix']) <= 5){
 $req = mysql_query("SELECT A.nom_produit, B.nom_support_euro, B.frais_gestion_euro, A.nom_assureur, A.nom_distributeur, A.fiscalite, A.type, A.commercialisation, B.2006, B.2007, B.2008, B.2009, B.2010, B.2011, A.logo_assureur, A.logo_distributeur FROM nom_support_euro B, tx_rendement A WHERE A.nom_produit=B.nom_produit AND A.nom_produit IN('".implode('\',\'', array_map('mysql_real_escape_string', $_POST['choix']))."') ORDER BY nom_produit ASC");
 
 echo '<form action="" method="post"><table class="sortable" id="tableau_contrats_en_euros">'."\n"; 
 echo '<center><table class="sortable" id="tableau_contrats_en_euros">'."\n"; 
echo'<caption>Rendements des Contrats</caption>'."\n";  
echo '<tr>'; 
echo '<th><b>Produit</b></td>'; 
echo '<th></th>'; 
echo '<th><b>Distributeur</b></td>'; 
echo '<th><b>Assureur</b></td>'; 
echo '<th><b>Fisacalité</b></td>'; 
echo '<th><b>Support €uro</b></td>'; 
echo '<th><b>Rendement 2009</b></td>'; 
echo '<th><b>Rendement 2010</b></td>'; 
echo '<th><b>Rendement 2011</b></td>'; 
echo '</tr>'."\n"; 

 while($row = mysql_fetch_assoc($req))
{ 
	echo '<tr>'; 
	echo '<td bgcolor="white"><b><font size="1"><a href="../contrat.php?nom='.$row['nom_produit'].'">'.$row["nom_produit" ].'</a></b></font></td>'; 
	if ($row['commercialisation'] == '')
		{
		echo '<td bgcolor="white"></td>';
		}
		else 
		{
		echo '<td bgcolor="white"><img src="../logos/interdit.png" alt="Plus commercialisé" title="Plus commercialisé" /> </td>';
		} 
if ($row['logo_distributeur'] == '')
{
echo '<td bgcolor="white">'.$row["nom_distributeur" ].'</td>';
}
else 
{
echo '<td bgcolor="white"><a href="../offres-distributeur.php?nom_distributeur='.$row['nom_distributeur'].'"><img src="../logos/tableaux/'. $row['logo_distributeur'].'" alt="'.$row["nom_distributeur" ].'" /></a></td>';
}
if ($row['logo_assureur'] == '')
{
echo '<td bgcolor="white">'.$row["nom_assureur" ].'</td>';
}
else 
{
echo '<td bgcolor="white"><a href="../offres-assureur.php?nom_assureur='.$row['nom_assureur'].'"><img src="../logos/tableaux/'. $row['logo_assureur'].'" alt="'.$row["nom_assureur" ].'" /></a></td>';
}
	echo '<td bgcolor="white">'.$row["fiscalite"].'</td>';
	if (($row['nom_support_euro'] == 'Fonds €uro') or ($row['nom_support_euro'] =='Actif Général'))
		{
		echo '<td>'.$row["nom_support_euro" ].'</td>'; 
		}
		else 
		{
		echo '<td><a href="../supports/euro.php?nom_support_euro='.$row['nom_support_euro'].'">'.$row["nom_support_euro" ].'</a></td>'; 
		} 
	echo '<td>'.$row["2009"].'</td>'; 
	echo '<td bgcolor="white">'.$row["2010"].'</td>'; 
	echo '<td>'.$row["2011"].'</td>'; 
	echo '</tr>'."\n"; 
} 
echo '<tr bgcolor="white"><td colspan="10"><a href="../caracteristiques/contrats-en-euros.php">Retour</a></td></tr>';
echo '</table></center>'."\n"; 
 }
else{
 if(isset($_POST['env']))
   echo '<div></div>';

$req = mysql_query("SELECT A.nom_produit, B.nom_support_euro, B.frais_gestion_euro, A.nom_assureur, A.nom_distributeur, A.fiscalite, A.type, A.commercialisation, B.2006, B.2007, B.2008, B.2009, B.2010, B.2011 FROM nom_support_euro B, tx_rendement A WHERE A.nom_produit=B.nom_produit and B.2011 <>('N/C' OR 'N/A' OR '') ORDER BY nom_produit ASC");

 echo '<form action="../caracteristiques/contrats-en-euros.php" method="post"><table class="sortable" id="tableau_contrats_en_euros">'."\n"; 
   echo 'Séléctionnez des contrats (maximum:5) pour en comparer les caractéristiques';

  
 echo'<caption>Rendements des Contrats</caption>'."\n";  
 echo '<tr>';
  echo '<th>Contrat</th>';
	echo '<th></th>';
echo '<th><b>Distributeur</b></td>'; 
echo '<th><b>Assureur</b></td>'; 
echo '<th><b>Fiscalité</b></td>'; 
echo '<th><b>Support €uro</b></td>'; 
echo '<th><b>Rendement 2009</b></td>'; 
echo '<th><b>Rendement 2010</b></td>'; 
echo '<th><b>Rendement 2011</b></td>'; 
echo '<th>Choix</th>';
echo '</tr>'."\n"; 

$i=1;
while($row=mysql_fetch_array($req)) 
{ 
echo '<tr>'; 
echo '<td bgcolor="white"><b><font size="1"><a href="../contrat.php?nom='.$row['nom_produit'].'">'.$row["nom_produit" ].'</a></b></font></td>'; 
  if ($row['commercialisation'] == '')
{
echo '<td bgcolor="white"></td>';
}
else 
{
echo '<td bgcolor="white"><img src="../logos/interdit.png" alt="Plus commercialisé" title="Plus commercialisé" /> </td>';
} 
echo '<td>'.$row["nom_distributeur"].'</td>'; 
echo '<td bgcolor="white">'.$row["nom_assureur"].'</td>'; 
echo '<td>'.$row["fiscalite"].'</td>';
 if (($row['nom_support_euro'] == 'Fonds €uro') or ($row['nom_support_euro'] =='Actif Général'))
{
echo '<td bgcolor="white">'.$row["nom_support_euro" ].'</td>'; 
}
else 
{
echo '<td bgcolor="white"><a href="../supports/euro.php?nom_support_euro='.$row['nom_support_euro'].'">'.$row["nom_support_euro" ].'</a></td>'; 
} 

	echo '<td>'.$row["2009"].'</td>'; 
	echo '<td bgcolor="white">'.$row["2010"].'</td>'; 
	echo '<td>'.$row["2011"].'</td>'; 
	echo '<td bgcolor="white"><input type="checkbox" name="choix[]" value="'.$row['nom_produit'].'" /></td>';
echo '</tr>'."\n"; 
if($i%20==0)
    {
/* tu insères ta pub */
    }
$i++;
} 

echo '</table></center>'."\n"; 

echo '<center><th colspan="8"><input type="submit" name="env" value="Envoyer" /></th></center></form>';
 }
?>

<?php include("pub/zanox/hsbc-horizontal-grand.php"); ?> 

<?php include("pied_de_page.php");?></div>
   </body>
</html>
Hors ligne cofloma # Posté le 09/02/2012 à 16:21:08

Merci,
Il n'y a plus de message mais la publicité est en dehors du tableau.
Exemple sur une autre page: http://www.cofloma.fr/caracteristiques/contrats-pep.php

Le code:
if($i%20==0)
{
/* tu insères ta pub */
}
$i++;
}

ESt-il bien positionné dans ma page ?
Hors ligne cofloma # Posté le 10/02/2012 à 21:58:53

Bonjour,

Avez-vous des idées pour résoudre mon problème?

Merci d'avance
Hors ligne philodick # Posté le 10/02/2012 à 22:17:21
Avatar

Ce n'est manifestement pas le même code... Ne me dis pas quand même que tu as laissé le code dans l'état. Tu as bien remplacé la ligne de commentaire quand même ?
Code : PHP
 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
<?php
$i=1;
while($row=mysql_fetch_array($req)) 
{ 
echo '<tr>'; 
echo '<td bgcolor="white"><b><font size="1"><a href="../contrat.php?nom='.$row['nom_produit'].'">'.$row["nom_produit" ].'</a></b></font></td>'; 
  if ($row['commercialisation'] == '')
   {
echo '<td bgcolor="white"></td>';
   }
else 
   {
echo '<td bgcolor="white"><img src="../logos/interdit.png" alt="Plus commercialisé" title="Plus commercialisé" /> </td>';
   } 
echo '<td>'.$row["nom_distributeur"].'</td>'; 
echo '<td bgcolor="white">'.$row["nom_assureur"].'</td>'; 
echo '<td>'.$row["fiscalite"].'</td>';
 if (($row['nom_support_euro'] == 'Fonds €uro') or ($row['nom_support_euro'] =='Actif Général'))
   {
echo '<td bgcolor="white">'.$row["nom_support_euro" ].'</td>'; 
   }
else 
   {
echo '<td bgcolor="white"><a href="../supports/euro.php?nom_support_euro='.$row['nom_support_euro'].'">'.$row["nom_support_euro" ].'</a></td>'; 
   } 

	echo '<td>'.$row["2009"].'</td>'; 
	echo '<td bgcolor="white">'.$row["2010"].'</td>'; 
	echo '<td>'.$row["2011"].'</td>'; 
	echo '<td bgcolor="white"><input type="checkbox" name="choix[]" value="'.$row['nom_produit'].'" /></td>';
echo '</tr>'."\n"; 
if($i%20==0)
    {
<?php include("pub/zanox/hsbc-horizontal-grand.php"); /* tu insères ta pub */ 
    }
$i++;
}
Hors ligne cofloma # Posté le 11/02/2012 à 00:58:04

Oui le commentaire a été remplacé.
le lien pour accéder à la page et voir le problème: http://www.cofloma.fr/caracteristiques/contrats-pep.php
la pub n'est pas intégrée dans le tableau.
Le code:
Code : PHP
 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
$i=1;
 while($dat = mysql_fetch_assoc($req))
 { 
  echo '<tr>';
  echo '<td bgcolor="white"><a href="../contrat.php?nom='.$dat['nom_produit'].'">'.$dat["nom_produit" ].'</a></b></font></td>';
  if ($dat['commercialisation'] == '')
{
echo '<td bgcolor="white"></td>';
}
else 
{
echo '<td bgcolor="white"><img src="../logos/interdit.png" alt="Plus commercialisé" title="Plus commercialisé" /> </td>';
} 
  echo '<td>'.$dat['nom_distributeur'].'</td>';
  echo '<td bgcolor="white">'.$dat["nom_assureur"].'</td>'; 	

   if ($dat['minimum_versement'] == '0 €')
{
echo '<td><b><font color="red">Aucun</font></b></td>';
}
else 
{
echo '<td>'.$dat["minimum_versement"].'</td>';
}  
    
  
   if ($dat['frais_versements'] == '0,00%')
{
echo '<td bgcolor="white"><b><font color="red">Gratuits</td></b></font>';
}
else 
{
echo '<td bgcolor="white">'.$dat["frais_versements"].'</td>';
}  
  
    if ($dat['frais_gestion_euro'] == '0,00%')
{
echo '<td><b><font color="red">Gratuit</td></b></font>';
}
else 
{
echo '<td>'.$dat["frais_gestion_euro"].'</td>';
}  

    if ($dat['frais_gestion_uc'] == '0,00%')
{
echo '<td bgcolor="white"><b><font color="red">Gratuit</td></b></font>';
}
else 
{
echo '<td bgcolor="white">'.$dat["frais_gestion_uc"].'</td>';
} 

  echo '<td><input type="checkbox" name="choix[]" value="'.$dat['nom_produit'].'" /></td>';

echo '</tr>'."\n"; 


if($i%10==0)
    {
include("../pub/zanox/hsbc-horizontal-grand.php");
    }
$i++;
} 

echo '</table></center>'."\n"; 

echo '<center><th colspan="8"><input type="submit" name="env" value="Envoyer" /></th></center></form>';
 }


?>

<?php include("../pub/zanox/hsbc-horizontal-grand.php"); ?> 

<?php include("../pied_de_page.php");?>
</div>
</div>
</body>
</html>

Merci
Hors ligne philodick # Posté le 11/02/2012 à 14:56:04
Avatar

Ok, mais il faut que tu prévois les balises html qui vont avec si c'est dans un tableau.
Code : PHP
 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
<?php
$i=1;
 while($dat = mysql_fetch_assoc($req))
 { 
  echo '<tr>';
  echo '<td bgcolor="white"><a href="../contrat.php?nom='.$dat['nom_produit'].'">'.$dat["nom_produit" ].'</a></b></font></td>';
  if ($dat['commercialisation'] == '')
{
echo '<td bgcolor="white"></td>';
}
else 
{
echo '<td bgcolor="white"><img src="../logos/interdit.png" alt="Plus commercialisé" title="Plus commercialisé" /> </td>';
} 
  echo '<td>'.$dat['nom_distributeur'].'</td>';
  echo '<td bgcolor="white">'.$dat["nom_assureur"].'</td>'; 	

   if ($dat['minimum_versement'] == '0 €')
{
echo '<td><b><font color="red">Aucun</font></b></td>';
}
else 
{
echo '<td>'.$dat["minimum_versement"].'</td>';
}  
    
  
   if ($dat['frais_versements'] == '0,00%')
{
echo '<td bgcolor="white"><b><font color="red">Gratuits</td></b></font>';
}
else 
{
echo '<td bgcolor="white">'.$dat["frais_versements"].'</td>';
}  
  
    if ($dat['frais_gestion_euro'] == '0,00%')
{
echo '<td><b><font color="red">Gratuit</td></b></font>';
}
else 
{
echo '<td>'.$dat["frais_gestion_euro"].'</td>';
}  

    if ($dat['frais_gestion_uc'] == '0,00%')
{
echo '<td bgcolor="white"><b><font color="red">Gratuit</td></b></font>';
}
else 
{
echo '<td bgcolor="white">'.$dat["frais_gestion_uc"].'</td>';
} 

  echo '<td><input type="checkbox" name="choix[]" value="'.$dat['nom_produit'].'" /></td>';

echo '</tr>'."\n"; 


if($i%10==0)
    {
echo '<tr><td>';
include("../pub/zanox/hsbc-horizontal-grand.php");
echo '</td></tr>';
    }
$i++;
} 

echo '</table></center>'."\n"; 

echo '<center><th colspan="8"><input type="submit" name="env" value="Envoyer" /></th></center></form>';
 }


?>

<?php include("../pied_de_page.php");?>
</div>
</div>
</body>
</html>

Retour au forum "PHP" ou à la liste des forums

Pour accéder à cette section
Connectez-vous !
connexion_rpx