Bonjour,
Je realise actuellement une application php/mysql devant permettre la gestion de notre teleprospection telephonique :
Apres authentification on peut accerder a la page contenant le listing des clients et si on clique sur un icone sur la ligne d'un client on peut modifier la fiche de celui-ci.
Or quand je clique sur le bouton de la page de modification j'obitiens une page d'erreur. Je n'arrive pas a trouver où cela bug je me tourne vers vous afin d'obtenir un regard "neuf" sur mon probleme voir peut etre une solution.
Voici le descriptif de ma base sql
Le code de ma page qui me pose probleme :
Code sql : 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
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 -- phpMyAdmin SQL Dump -- version 4.0.4 -- <a href="http://www.phpmyadmin.net" target="_blank">http://www.phpmyadmin.net</a> -- -- Client: localhost -- Généré le: Lun 21 Novembre 2016 à 06:41 -- Version du serveur: 5.6.12-log -- Version de PHP: 5.4.12 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Base de données: `oni_test_1` -- CREATE DATABASE IF NOT EXISTS `oni_test_1` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; USE `oni_test_1`; -- -------------------------------------------------------- -- -- Structure de la table `admin` -- CREATE TABLE IF NOT EXISTS `admin` ( `adminid` tinyint(3) unsigned NOT NULL AUTO_INCREMENT, `adminusername` varchar(15) COLLATE latin1_general_ci NOT NULL, `adminpassword` varchar(15) COLLATE latin1_general_ci NOT NULL, PRIMARY KEY (`adminid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=2 ; -- -- Contenu de la table `admin` -- INSERT INTO `admin` (`adminid`, `adminusername`, `adminpassword`) VALUES (1, 'admin', 'admin'); -- -------------------------------------------------------- -- -- Structure de la table `appel` -- CREATE TABLE IF NOT EXISTS `appel` ( `id_appel` tinyint(8) unsigned NOT NULL AUTO_INCREMENT, `date_appel` datetime DEFAULT NULL, `comp_appel` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `dater_appel` datetime DEFAULT NULL, `rappel_appel` tinyint(2) DEFAULT NULL, `datet_appel` datetime DEFAULT NULL, `transf_appel` tinyint(2) DEFAULT NULL, PRIMARY KEY (`id_appel`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ; -- -- Contenu de la table `appel` -- INSERT INTO `appel` (`id_appel`, `date_appel`, `comp_appel`, `dater_appel`, `rappel_appel`, `datet_appel`, `transf_appel`) VALUES (1, '2016-11-01 00:00:00', 'tout va bien', NULL, NULL, NULL, NULL); -- -------------------------------------------------------- -- -- Structure de la table `personne` -- CREATE TABLE IF NOT EXISTS `personne` ( `id_pers` int(8) unsigned NOT NULL AUTO_INCREMENT, `num_oni_pers` int(8) DEFAULT NULL, `dep_pers` int(3) DEFAULT NULL, `nom_pers` varchar(30) COLLATE utf8_unicode_ci NOT NULL, `prenom_pers` varchar(30) COLLATE utf8_unicode_ci NOT NULL, `ddn_pers` date DEFAULT NULL, `date_pers` date DEFAULT NULL, `comp_pers` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `num_appel_pers` int(8) NOT NULL, PRIMARY KEY (`id_pers`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=8 ; -- -- Contenu de la table `personne` -- INSERT INTO `personne` (`id_pers`, `num_oni_pers`, `dep_pers`, `nom_pers`, `prenom_pers`, `ddn_pers`, `date_pers`, `comp_pers`, `num_appel_pers`) VALUES (2, 123, 35, 'LAGARDE', 'RAPHAEL', '1974-05-26', '1974-05-26', 'azertyuiop', 12345678), (4, 124, 53, 'FOURCHE', 'WILLIAM', NULL, NULL, NULL, 0), (5, 125, 75, 'RODET', 'Denis', '1950-11-01', NULL, NULL, 0), (7, 1234, 56, 'LEFEBVRE', 'JACQUELINE', '1943-06-08', NULL, NULL, 0); /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
voila la description de mon probleme :
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
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187 <?php require_once('../Connections/ma_connexion.php'); ?> <?php require_once('security.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE personne SET num_oni_pers=%s, dep_pers=%s, nom_pers=%s, prenom_pers=%s, ddn_pers=%s, date_pers=%s, comp_pers=%s, num_appel_pers=%s WHERE id_pers=%s", GetSQLValueString($_POST['num_oni_pers'], "int"), GetSQLValueString($_POST['dep_pers'], "int"), GetSQLValueString($_POST['nom_pers'], "varchar"), GetSQLValueString($_POST['prenom_pers'], "varchar"), GetSQLValueString($_POST['ddn_pers'], "date"), GetSQLValueString($_POST['date_pers'], "date"), GetSQLValueString($_POST['comp_pers'], "varchar"), GetSQLValueString($_POST['num_appel_pers'], "int"), GetSQLValueString($_POST['id_pers'], "int")); mysql_select_db($database_ma_connexion, $ma_connexion); $Result1 = mysql_query($updateSQL, $ma_connexion) or die(mysql_error()); $updateGoTo = "liste_infirmiers.php"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); } $colname_RsmodifEmployes = "-1"; if (isset($_GET['id_pers'])) { $colname_RsmodifEmployes = $_GET['id_pers']; } mysql_select_db($database_ma_connexion, $ma_connexion); $query_RsmodifEmployes = sprintf("SELECT * FROM personne WHERE id_pers = %s", GetSQLValueString($colname_RsmodifEmployes, "int")); $RsmodifEmployes = mysql_query($query_RsmodifEmployes, $ma_connexion) or die(mysql_error()); $row_RsmodifEmployes = mysql_fetch_assoc($RsmodifEmployes); $totalRows_RsmodifEmployes = mysql_num_rows($RsmodifEmployes); ?> <!--<?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $colname_RsmodifEmployes = "-1"; if (isset($_GET['id'])) { $colname_RsmodifEmployes = $_GET['id']; } mysql_select_db($database_ma_connexion, $ma_connexion); $query_RsmodifEmployes = sprintf("SELECT * FROM personne WHERE id_pers = %s", GetSQLValueString($colname_RsmodifEmployes, "int")); $RsmodifEmployes = mysql_query($query_RsmodifEmployes, $ma_connexion) or die(mysql_error()); $row_RsmodifEmployes = mysql_fetch_assoc($RsmodifEmployes); $totalRows_RsmodifEmployes = mysql_num_rows($RsmodifEmployes); ?> --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Modification infirmier</title> <link href="../css/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="wrapper"> <div id="header"><span>ADMINISTRATION DES INFIRMIERS</span></div> <div id="navigation"> <a href="liste_infirmiers.php">Liste des infirmiers</a> | <a href="ajout_infirmiers.php">Ajouter un infirmiers</a> | <a href="logout.php">Déconnexion</a> </div> <div id="container"> <p id="ptitle">Ajout d'un infirmier</p> </div> <div id="footer"> <p>rltic.info</p> <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1"> <table align="center"> <tr> <td>num_oni_pers :</td> <td><input type="text" name="num_oni_pers" value="<?php echo htmlentities($row_RsmodifEmployes['num_oni_pers'], ENT_COMPAT, 'iso-8859-1'); ?>" size="32" /></td> </tr> <tr> <td>dep_pers :</td> <td><input type="text" name="dep_pers" value="<?php echo htmlentities($row_RsmodifEmployes['dep_pers'], ENT_COMPAT, 'iso-8859-1'); ?>" size="32" /></td> </tr> <tr> <td>nom_pers :</td> <td><input type="text" name="nom_pers" value="<?php echo htmlentities($row_RsmodifEmployes['nom_pers'], ENT_COMPAT, 'iso-8859-1'); ?>" size="32" /></td> </tr> <tr> <td>prenom_pers :</td> <td><input type="text" name="prenom_pers" value="<?php echo htmlentities($row_RsmodifEmployes['prenom_pers'], ENT_COMPAT, 'iso-8859-1'); ?>" size="32" /></td> </tr> <tr> <td>ddn_pers :</td> <td><input type="text" name="ddn_pers" value="<?php echo htmlentities($row_RsmodifEmployes['ddn_pers'], ENT_COMPAT, 'iso-8859-1'); ?>" size="32" /></td> </tr> <tr> <td>Date Pers :</td> <td><input type="text" name="date_pers" value="<?php echo htmlentities($row_RsmodifEmployes['date_pers'], ENT_COMPAT, 'iso-8859-1'); ?>" size="32" /></td> </tr> <tr> <td>Comp Pers :</td> <td><input type="text" name="comp_pers" value="<?php echo htmlentities($row_RsmodifEmployes['comp_pers'], ENT_COMPAT, 'iso-8859-1'); ?>" size="32" /></td> </tr> <tr> <td>Num Appel Pers :</td> <td><input type="text" name="num_appel_pers" value="<?php echo htmlentities($row_RsmodifEmployes['num_appel_pers'], ENT_COMPAT, 'iso-8859-1'); ?>" size="32" /></td> </tr> <tr> <td> </td> <td><input type="submit" value="Mettre à jour l'enregistrement" /></td> </tr> </table> <input type="hidden" name="MM_update" value="form1" /> <input type="hidden" name="id_pers" value="<?php echo $row_RsmodifEmployes['id_pers']; ?>" /> </form> <p> </p> </div> </div> </body> </html> <?php mysql_free_result($RsmodifEmployes); ?>
a) quand j'appelle par l'url : http://localhost/tuto_dream2/admin/m...miers.php?id=5
la page apparait avec les informations dans les champs correspondant mais quand je modifie le champ "num_appel_pers" et que je clique sur le bouton pour valider la modification j'obtiens une fenetre d'erreur affichant : " 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 ' num_appel_pers=2 WHERE id_pers=5' at line 1 "
b) quand j'appelle par l'url : http://localhost/tuto_dream2/admin/m...miers.php?id=2
la page apparait avec les informations dans les champs correspondant mais quand je modifie un champ et que je clique sur le bouton pour valider la modification j'obtiens une fenetre d'erreur affichant : " Unknown column 'LAGARDE' in 'field list' "
quelqu'un aurait il une idee, un conseil, une solution ?
SVP merci
Raphael
Partager