bonjour, j'espere que vous avez passe un bon noel
je cherche a mettre un msg personnalise en fonction de la presence ou non d'un contact dans ma bd
ma recherche de doublons a l'air de fonctionner mais pas l'affichage du message
je ne trouve pas mon erreur malgres mes recherche
Merci d'avance de votre aide
voici mon code
<?php
include('includes/config.php');
$connect=mysql_connect($host, $user,$password) or die("Impossible de ce connecter au serveur $host");
$connect_bd=mysql_select_db($bdd) or die("Impossible de ce connecter a la base de donnees $bdd");
$table="client";
$table2="client_contact";
$table3="client_projet";
$date=date("Y-m-d");
$heure = date("H:i");
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
$IP = $_SERVER['HTTP_X_FORWARDED_FOR'];
elseif(isset($_SERVER['HTTP_CLIENT_IP']))
$IP = $_SERVER['HTTP_CLIENT_IP'];
else
$IP = $_SERVER['REMOTE_ADDR'];
$modulaire = $_POST['piscine_modulaire'];
$coque = $_POST['piscine_coque'];
$abri = $_POST['abris_piscine'];
$projet = $_POST['projet'];
$mois = $_POST['mois'];
$mail = $_POST['email'];
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$adresse = $_POST['adresse'];
$cp = $_POST['cp'];
$ville = $_POST['ville'];
$tel = $_POST['telephone'];
$date_contact = $_POST['date_contact'];
$heure_contact=$_POST['heure_contact'];
$msg=$_POST['msg'];
$result = mysql_query("SELECT id_client FROM $table ORDER BY id_client DESC LIMIT 0,1");
$row = mysql_fetch_array($result);
$id_client=$row["id_client"]+1;
if ($connect_bd=='true'){
$query = "SELECT nom FROM $table WHERE nom='$nom' and prenom='$prenom' and cp='$cp' and ville='$ville'";
$result = mysql_query($query);
$res = mysql_num_rows($result);
// Recuperation des resultats
if ($res==0) {
// remplir bd
$remplir=mysql_query("INSERT INTO $table(id,id_client,ip,date,heure,nom,prenom,adresse,cp,ville,tel,email) VALUES ('$id_client','$id_client','$IP','$date','$heure','$nom','$prenom','$adresse','$cp','$ville','$tel','$mail')") or die ("Impossible de ce connecter à la table".mysql_error());
$remplir2=mysql_query("INSERT INTO $table2(id_client,date,heure,commentaire) VALUES ('$id_client','$date_contact','$heure_contact','$msg')") or die ("Impossible de ce connecter à la table".mysql_error());
$remplir3=mysql_query("INSERT INTO $table3(id_client,piscine_beton,piscine_coque,abris_piscine,projet,periode) VALUES ('$id_client','$modulaire','$coque','$abri','$projet','$mois')") or die ("Impossible de ce connecter à la table".mysql_error());
$titre="MERCI D'AVOIR REMPLI LE FORMULAIRE.";
$titres='0';
//ajouter envois mail html php
}
else {
$titre="Vous avez déja fait une demande de doc.<br>Si ce n'était pas le cas, merci de nous appeler.";
$titres='1';
}
echo"titre $titres res $res";
}
else{
echo"Serveur indisponible, merci de réessayer ultérieurement";
}
mysql_query("OPTIMIZE TABLES {$table};");
mysql_query("OPTIMIZE TABLES {$table2};");
mysql_query("OPTIMIZE TABLES {$table3};");
?>
<table border="0" width="100%" id="table1" height="100%" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" height="1">
<img border="0" src="images/logo-piscine-capblue.gif" width="299" height="116">
</td>
<td width="315" rowspan="3" align="center" valign="top">
<table border="0" width="100%" id="table2" height="100%" cellspacing="0" cellpadding="0">
<tr>
<td height="10" bgcolor="#FC5187">
<p style="margin:10px; " align="center">
<b><font face="arial" size="2" color="#000080">
<script LANGUAGE="JavaScript1.2">
function initArray() {
this.length = initArray.arguments.length;
for (var i = 0; i < this.length; i++) {
this[i] = initArray.arguments[i];
}
}
var ctext = "<?echo"$titre";?>";
var speed = 1000;
var x = 0;
var color = new initArray(
"white",
"#000080");
if(navigator.appName == "Netscape") {
document.write('<layer id="c">' +ctext+'</layer><br>');
} if (navigator.appVersion.indexOf("MSIE") != -1){
document.write('<div id="c">'+ctext+'</div>');
}
function chcolor(){
if(navigator.appName == "Netscape") {
document.c.document.write('<font color="'+color[x]);
document.c.document.write('">'+ctext+'</font>');
document.c.document.close();
}
else if (navigator.appVersion.indexOf("MSIE") != -1){
document.all.c.style.color = color[x];
}
(x < color.length-1) ? x++ : x = 0;
}
setInterval("chcolor()",1000);
// -->
</script>
</font></b></p></td>
</tr>
<tr>
<td align="justify" <?php
if ($titres==0){}else{?>background="images/capblue-piscine.gif"<?}
?>
<font face="MS Sans Serif" size="1">
<p style="margin:10px; ">
<?php
if ($titres==0){
echo "Bonjour Mme, Mr <b> $prenom $nom</b>,\n nous allons vous faire parvenir le(s) catalogue(s) :";
echo "<br />";
echo "<ul>";
if ($modulaire !="") {
echo"<li> catalogue piscine modulaire</li>";
}
if ($coque !="") {
echo"<li> catalogue piscine monocoque</li>";
}
if ($abri !="" ){
echo"<li> catalogue abri de piscine</li>";
}
echo "</ul>";
echo "<br />";
echo " à l'adresse suivante :";
echo "<br />";
echo "<br />";
echo "<b> $prenom $nom</b>";
echo "<br />";
echo "<b>$adresse</b>";
echo "<br />";
echo "<b>$cp $ville</b>";
echo "<br />";
echo "<br />";
echo "Un mail de confirmation avec la synthèse des renseignements founis vous à été envoyé à l'adresse mail suivante :";
echo "<br />";
echo "<br />";
echo "<b>$email</b>";
}
else{
}
?>
</p></font>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" valign="top">
<p style="margin-left: 30px; margin-top: 10px"><b>
<font color="#000080" face="Arial">Pour nous contacter</font></b></p>
<p style="margin-left: 30px; margin-top: 0; margin-bottom: 0"><b>
<font size="2" face="Arial"><font color="#000080">toto- </font>
<a target="_self" href="http://www.toto.fr/"><font color="#000080">toto</font></a><font color="#000080"> <br>
</font>
</font></b><font face="MS Sans Serif" size="2">Siège social :<br>
adresse<br>
</font><br>
<font size="2" face="MS Sans Serif">Tél. </font>
<span style="font-size: 9.0pt; font-family: MS Sans Serif">33(0) </span><font size="2" face="MS Sans Serif"><br>
Fax </font><span style="font-size: 9.0pt; font-family: MS Sans Serif">
33(0) </span></p>
<p style="margin-left: 30px; margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-left: 30px; margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-left: 30px; margin-top: 0; margin-bottom: 0">
<span style="font-family: MS Sans Serif; font-size: 9pt">@mail :
<a href="mailto:[email protected]">[email protected]</a></span></p>
<p style="margin-left: 30px"> </td>
</tr>
<tr>
<td align="left" valign="bottom" height="1">
</td>
</tr>
</table>
<?php
mysql_close ($connect); ?>
[Note : ce message a été posté de manière anonyme avant d'être réattribué à son auteur]
bonjour, j'espere que vous avez passe un bon noel
je cherche a mettre un msg personnalise en fonction de la presence ou non d'un contact dans ma bd
ma recherche de doublons a l'air de fonctionner mais pas l'affichage du message
je ne trouve pas mon erreur malgres mes recherche
Merci d'avance de votre aide
voici mon code
[php]
<?php
include('includes/config.php');
$connect=mysql_connect($host, $user,$password) or die("Impossible de ce connecter au serveur $host");
$connect_bd=mysql_select_db($bdd) or die("Impossible de ce connecter a la base de donnees $bdd");
$table="client";
$table2="client_contact";
$table3="client_projet";
$date=date("Y-m-d");
$heure = date("H:i");
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
$IP = $_SERVER['HTTP_X_FORWARDED_FOR'];
elseif(isset($_SERVER['HTTP_CLIENT_IP']))
$IP = $_SERVER['HTTP_CLIENT_IP'];
else
$IP = $_SERVER['REMOTE_ADDR'];
$modulaire = $_POST['piscine_modulaire'];
$coque = $_POST['piscine_coque'];
$abri = $_POST['abris_piscine'];
$projet = $_POST['projet'];
$mois = $_POST['mois'];
$mail = $_POST['email'];
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$adresse = $_POST['adresse'];
$cp = $_POST['cp'];
$ville = $_POST['ville'];
$tel = $_POST['telephone'];
$date_contact = $_POST['date_contact'];
$heure_contact=$_POST['heure_contact'];
$msg=$_POST['msg'];
$result = mysql_query("SELECT id_client FROM $table ORDER BY id_client DESC LIMIT 0,1");
$row = mysql_fetch_array($result);
$id_client=$row["id_client"]+1;
if ($connect_bd=='true'){
$query = "SELECT nom FROM $table WHERE nom='$nom' and prenom='$prenom' and cp='$cp' and ville='$ville'";
$result = mysql_query($query);
$res = mysql_num_rows($result);
// Recuperation des resultats
if ($res==0) {
// remplir bd
$remplir=mysql_query("INSERT INTO $table(id,id_client,ip,date,heure,nom,prenom,adresse,cp,ville,tel,email) VALUES ('$id_client','$id_client','$IP','$date','$heure','$nom','$prenom','$adresse','$cp','$ville','$tel','$mail')") or die ("Impossible de ce connecter à la table".mysql_error());
$remplir2=mysql_query("INSERT INTO $table2(id_client,date,heure,commentaire) VALUES ('$id_client','$date_contact','$heure_contact','$msg')") or die ("Impossible de ce connecter à la table".mysql_error());
$remplir3=mysql_query("INSERT INTO $table3(id_client,piscine_beton,piscine_coque,abris_piscine,projet,periode) VALUES ('$id_client','$modulaire','$coque','$abri','$projet','$mois')") or die ("Impossible de ce connecter à la table".mysql_error());
$titre="MERCI D'AVOIR REMPLI LE FORMULAIRE.";
$titres='0';
//ajouter envois mail html php
}
else {
$titre="Vous avez déja fait une demande de doc.<br>Si ce n'était pas le cas, merci de nous appeler.";
$titres='1';
}
echo"titre $titres res $res";
}
else{
echo"Serveur indisponible, merci de réessayer ultérieurement";
}
mysql_query("OPTIMIZE TABLES {$table};");
mysql_query("OPTIMIZE TABLES {$table2};");
mysql_query("OPTIMIZE TABLES {$table3};");
?>
<table border="0" width="100%" id="table1" height="100%" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" height="1">
<img border="0" src="images/logo-piscine-capblue.gif" width="299" height="116">
</td>
<td width="315" rowspan="3" align="center" valign="top">
<table border="0" width="100%" id="table2" height="100%" cellspacing="0" cellpadding="0">
<tr>
<td height="10" bgcolor="#FC5187">
<p style="margin:10px; " align="center">
<b><font face="arial" size="2" color="#000080">
<script LANGUAGE="JavaScript1.2">
function initArray() {
this.length = initArray.arguments.length;
for (var i = 0; i < this.length; i++) {
this[i] = initArray.arguments[i];
}
}
var ctext = "<?echo"$titre";?>";
var speed = 1000;
var x = 0;
var color = new initArray(
"white",
"#000080");
if(navigator.appName == "Netscape") {
document.write('<layer id="c">' +ctext+'</layer><br>');
} if (navigator.appVersion.indexOf("MSIE") != -1){
document.write('<div id="c">'+ctext+'</div>');
}
function chcolor(){
if(navigator.appName == "Netscape") {
document.c.document.write('<font color="'+color[x]);
document.c.document.write('">'+ctext+'</font>');
document.c.document.close();
}
else if (navigator.appVersion.indexOf("MSIE") != -1){
document.all.c.style.color = color[x];
}
(x < color.length-1) ? x++ : x = 0;
}
setInterval("chcolor()",1000);
// -->
</script>
</font></b></p></td>
</tr>
<tr>
<td align="justify" <?php
if ($titres==0){}else{?>background="images/capblue-piscine.gif"<?}
?>
<font face="MS Sans Serif" size="1">
<p style="margin:10px; ">
<?php
if ($titres==0){
echo "Bonjour Mme, Mr <b> $prenom $nom</b>,\n nous allons vous faire parvenir le(s) catalogue(s) :";
echo "<br />";
echo "<ul>";
if ($modulaire !="") {
echo"<li> catalogue piscine modulaire</li>";
}
if ($coque !="") {
echo"<li> catalogue piscine monocoque</li>";
}
if ($abri !="" ){
echo"<li> catalogue abri de piscine</li>";
}
echo "</ul>";
echo "<br />";
echo " à l'adresse suivante :";
echo "<br />";
echo "<br />";
echo "<b> $prenom $nom</b>";
echo "<br />";
echo "<b>$adresse</b>";
echo "<br />";
echo "<b>$cp $ville</b>";
echo "<br />";
echo "<br />";
echo "Un mail de confirmation avec la synthèse des renseignements founis vous à été envoyé à l'adresse mail suivante :";
echo "<br />";
echo "<br />";
echo "<b>$email</b>";
}
else{
}
?>
</p></font>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" valign="top">
<p style="margin-left: 30px; margin-top: 10px"><b>
<font color="#000080" face="Arial">Pour nous contacter</font></b></p>
<p style="margin-left: 30px; margin-top: 0; margin-bottom: 0"><b>
<font size="2" face="Arial"><font color="#000080">toto- </font>
<a target="_self" href="http://www.toto.fr/"><font color="#000080">toto</font></a><font color="#000080"> <br>
</font>
</font></b><font face="MS Sans Serif" size="2">Siège social :<br>
adresse<br>
</font><br>
<font size="2" face="MS Sans Serif">Tél. </font>
<span style="font-size: 9.0pt; font-family: MS Sans Serif">33(0) </span><font size="2" face="MS Sans Serif"><br>
Fax </font><span style="font-size: 9.0pt; font-family: MS Sans Serif">
33(0) </span></p>
<p style="margin-left: 30px; margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-left: 30px; margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-left: 30px; margin-top: 0; margin-bottom: 0">
<span style="font-family: MS Sans Serif; font-size: 9pt">@mail :
<a href="mailto:
[email protected]">
[email protected]</a></span></p>
<p style="margin-left: 30px"> </td>
</tr>
<tr>
<td align="left" valign="bottom" height="1">
</td>
</tr>
</table>
<?php
mysql_close ($connect); ?>[/php]
[i][color=darkred][Note : ce message a été posté de manière anonyme avant d'être réattribué à son auteur][/color][/i]