Bonsoir
J'ai dans ma base de données une table publication qui contient les champs suivants:idpub,auteur,annee,lien,infos,type.
Je veux dans mon site faire une recherche de publications selon type,auteur et annee
Voila mon code mais j'ai des erreurs que je pas les corriger s'il vous plait vous pouvez m'aider je serais trés reconnaissante à vous
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
<?php
$connexion=mysql_connect('localhost','root','') or die ('connexion echouer');
$bd=mysql_select_db('unite',$connexion) or die ('base est insufisant');
 
$sql='SELECT * FROM publication where type="'.$_POST['type'].'",annee="'.$_POST['annee'].'",auteur="'.$_POST['auteur'].'"';
$req =mysql_query($sql) or die('Erreur SQL !'.$sql.'<br />'.mysql_error());
 
while($tab = mysql_fetch_row($req))
{
echo"<table><tr><th>$tab[type]</th></tr>
<tr><td>$tab[auteur]</td><td>$tab[infos]</td></tr>
<tr><td>$tab[lien]</td></tr>";
}
?>
<form name ="form" action="publication.php" method="post">
<div class="form-title"><h2><font color="#006666">Publications du IResCOMATH</font></h2><hr size="3"</div>
<h3><p>Type:</p></h3>
<input type="text" name="type" size="30"><br>
<h3><p>Annee:</p></h3>
<input type="date" name="annee" size="30"><br>
<p> <h3>Auteur:</h3></p>
<input type="text" name="auteur">
<input type="submit" style="background:#0066666; cursor:hand; border:solid 2px black;"
        style="background:white; cursor:pointer; border:solid 2px black;" value="OK">
 <input  type="reset" style="background:#0066666; cursor:hand; border:solid 2px black;"
        style="background:white; cursor:pointer; border:solid 2px black; "value="Reint">
 
</div>
</form>

voila aussi les erreurs:
Notice: Undefined index: type in C:\wamp\www\IResCOMATH\publication.php on line 5
Notice: Undefined index: annee in C:\wamp\www\IResCOMATH\publication.php on line 5
Notice: Undefined index: auteur in C:\wamp\www\IResCOMATH\publication.php on line 5
Erreur SQL !SELECT * FROM publication where type="",annee="",auteur=""
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'annee="",auteur=""' at line 1