Bonjour,
j'ai fait un dropdown liste pour filtrer les résultats d'un tableau,
je choisi par exemple un niveau et je click submit pour afficher les classes
mais il affiche cette erreur :


---- Query to show fields from table grade ---> 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 '[LEVEL] INNER JOIN grade ON LEVEL.ID_level=grade.ID_level where level_name='Leve' at line 1



Voici un parti du code

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
 
require("conn.php");
$table = 'grade';
 
if (!mysql_connect($db_host, $db_user, $db_pwd))
    die("Can't connect to database");
 
if (!mysql_select_db($database))
    die("Can't select database");
 
 
$dState = $_POST["level_name"];
echo $dState;
$result = mysql_query("SELECT $table.grade_name FROM [LEVEL] INNER JOIN $table ON LEVEL.ID_level=$table.ID_level where level_name=\"$dState\"");
if (!$result) {
    die(" ---- Query to show fields from table $table ---> ".mysql_error());
}


Merci