salut,
je concoit un site dynamique avec php/mysql. je travaille avec l'environnemnt wamp 2.0 .
je veux recuperer des donnees dans ma bd et les afficher ds un tableau. mais j'ai ce msg d'erreur a chaque fois:
voici le code du formulaire de declenche la recuperation :Erreur SQL : select * from agences where ville_agence == "yaounde"
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 '== "yaounde"' at line 1
le script de ma requette:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 <td height="24" align="left" valign="top"><label>Choix de la ville:</label> <select name="_ville"> <option value="yaounde">yaounde</option> </select> </tr> <tr> <td align="left" valign="top"><div align="center"> <input name="trouv_agence" type="submit" value="Rechercher"/> </div></td>
le script de ma table agences:
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
30
31 <?php $vil_agence=trim($_POST['_ville']); require_once ("mes_fonctions.php"); connection_bd(); $query = ('select * from agences where ville_agence == "'.$vil_agence.'"'); $res_query = mysql_query($query)or die("Erreur SQL : $query<br/>".mysql_error());; echo " <table width=\"550\" border=\"1\" cellspacing=\"0\" align=\"center\" bordercolor=\"#FFFF00\"> <tr bgcolor=\"#FFFF00\"> <td><div align=\"center\"><span class=\"Style50\">Agence</span></div></td> <td width=\"100\"><div align=\"center\"><span class=\"Style50\">Ville</span></div></td> <td width=\"100\><div align=\"center\"><span class=\"Style50\">Quartier</span></div></td> <td><div align=\"center\"><span class=\"Style50\">Adresse agence</span></div></td> <td><div align=\"center\"><span class=\"Style50\">Contact</span></div></td> </tr> "; while ($row =mysql_fetch_array ($res_query) ) { echo " <tr bgcolor=\"#FFFFFF\"> <td><div align=\"center\"><span class=\"Style50\"><strong>$row[nom_agence]</strong></span></div></td> //<td><div align=\"center\"><span class=\"Style50\"><strong>$row[ville_agence]</strong></span></div></td> <td><div align=\"center\"><span class=\"Style50\"><strong>$row[quartier_agence]</strong></span></div></td> <td><div align=\"center\"><span class=\"Style50\"><strong>$row[adresse_agence]</strong></span></div></td> <td><div align=\"center\"><span class=\"Style50\"><strong>$row[contact]</strong></div></span></td> </tr>"; } echo " </table> "; ?>
aidez moi a resoudre ce probleme svp
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
30
31
32
33
34
35
36
37
38
39
40
41 -- phpMyAdmin SQL Dump -- version 2.11.6 -- http://www.phpmyadmin.net -- -- Serveur: localhost -- Généré le : Mar 16 Juin 2009 à 15:07 -- Version du serveur: 5.0.51 -- Version de PHP: 5.2.6 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Base de données: `gescour` -- -- -------------------------------------------------------- -- -- Structure de la table `agences` -- CREATE TABLE `agences` ( `nom_agence` varchar(50) NOT NULL, `ville_agence` varchar(50) NOT NULL, `rue_agence` varchar(50) default NULL, PRIMARY KEY (`nom_agence`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Contenu de la table `agences` -- INSERT INTO `agences` (`nom_agence`, `ville_agence`, `rue_agence`) VALUES (' abbia', 'yaounde', 'marche des fleurs'), ('beau sejour', 'Douala', 'Akwa nord'), ('solex baffoussam', 'baffoussam', 'entree chefferie'), ('solex bamenda', 'bamenda', 'Carrefour Vetenary Jonction '), ('solex garoua', 'garoua', 'Carrefour RDPC, face SANAGA Voyages '), ('solex maroua', 'maroua', 'Immeuble Ecobank '), ('solex ndere', 'ngaoundere', 'Descente gare ');
merci bien
Partager