Variabele wordt 'vertraagd' bijgewerkt
Ik zit met een probleem waar ik even niet uit kom. Het lijkt er op dat een variabele, $nRecord, vertraagd of soms niet wordt bijgewerkt danwel een andere waarde aanneemt.
Het gaat om een simpele routine:
1. Ik laad eerst een aantal records uit een database en toon die in een scherm
2. Vervolgens selecteer ik een record om te muteren (De $_GET geeft hier bijv. 2)
3. Ik muteer het record
4. Ik update de tabel met de nieuwe gegevens. (De WHERE geeft hier een ander recordnummer dan in de $_GET opgehaald)
Nu is het zo dat de waarde van variabele $nRecord niet altijd de waarde heeft van het id van het te muteren record.
Ik zal waarschijnlijk wel een loop ergens hebben zitten die ik niet zie. Zien jullie mijn fout ergens?
Code (php)
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
<?php
/**
* @author George van Baasbank
* @package Podiumspektakel
* @subpackage repetitieplanner
* @copyright Ermelo Software
* @since 05-06-2014
* bestandsnaam repetitieplanner.php
* beschrijving Module om repetities te plannen
* opmerking
* taalmodule
* e-mail [email protected]
* project Podiumspektakel
* Tijdstempel // <!-- phpDesigner :: Timestamp [6/8/2014 12:47:28 PM] -->
*
*/
/**
* Wijzigingslog
*
* Datum Developer Aanpassing
* 05-06-2014 George Ontwikkeling
*
*/
session_start();
error_reporting(0);
require_once "include/pod_config.inc.php";
include "include/systeem.inc.php";
include "functies/functiebieb.inc.php";
// Declaratie variabelen
$lWijzigen = false;
$cKnopTekst01 = "Wijzigen";
// Geindexeerde array met dagen
$aDagen = array (
0 => 'zo',
'ma',
'di',
'wo',
'do',
'vr',
'za',
);
// Inlezen bestaande planningen en gegevens
include "include/connectie.inc.php";
// Bestaande planning
include "queries/sql_sel_rooster.php";
$cResultPlanning = mysqli_query($verbinding,$sql);
// Beschikbare lokaties
include "queries/sql_sel_lokatie.php";
$cResultLokatie = mysqli_query($verbinding,$sql);
// Beschikbare gebruikers
include "queries/sql_sel_gebruiker.php";
$cResultGebruiker = mysqli_query($verbinding,$sql);
mysqli_close($verbinding);
if($_SERVER['REQUEST_METHOD'] === 'POST') {
$cActie = $_POST['submit'];
$nRecord = $_SESSION['recordnr'];
if($cActie == $cKnopTekst01) { // Wijzigen planning
include "include/connectie.inc.php";
$cGebruiker = $_POST['gebruiker'];
$dDatum = $_POST['datum'];
$cAanvang = $_POST['aanvang'];
$cEinde = $_POST['einde'];
$cLokatie = $_POST['lokatie'];
$cTekst = mysqli_real_escape_string($verbinding,$_POST['tekst']);
$sql = "UPDATE pod__rooster SET datum = '$dDatum', aanvang = '$cAanvang', einde = '$cEinde', lokatie = '$cLokatie', gebruiker = '$cGebruiker', omschrijving = '$cTekst', mutatie = 'George' WHERE id = '$nRecord'";
echo $sql;
$cResultWijziging = mysqli_query($verbinding,$sql);
mysqli_close($verbinding);
}
}
if($_GET['id']) {
$nRecord = $_GET['id'];
$_SESSION['recordnr'] = $nRecord;
$lWijzigen = true;
include "include/connectie.inc.php";
$sql = "SELECT pr.*,ss.inhoud AS lok FROM pod__rooster AS pr JOIN sys__select AS ss ON ss.waarde = pr.lokatie WHERE pr.id = '$nRecord'";
echo $sql;
$cResultPlan = mysqli_query($verbinding,$sql);
$rowPlan = mysqli_fetch_array($cResultPlan);
$_SESSION['plangebruiker'] = $rowPlan['gebruiker'];
$_SESSION['planlokatie'] = $rowPlan['lokatie'];
mysqli_close($verbinding);
}
?>
<!DOCTYPE html>
<html lang="nl">
<head>
<title>Repetitiepplanner | Podiumspektakel 2015</title>
<meta charset="utf-8" />
<meta http-equiv="content-type" content="text/html" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="robots" content="noindex,nofollow" />
<meta name="googlebot" content="noodp, noarchive, nosnippet, noindex, nofollow" />
<meta name="keywords" content="<?php echo $cMetaKeywords ; ?>" />
<meta name="author" content="<?php echo $cMetaAuteur ; ?>" />
<meta name="description" content="<?php echo $cMetaDescription ; ?>" />
<meta name="copyright" content="Ermelo Software 2014" />
<link rel="stylesheet" href="styles/elegant-press.css" type="text/css" />
<script src="scripts/elegant-press.js" type="text/javascript"></script>
<!--[if IE]><style>#header h1 a:hover{font-size:75px;}</style><![endif]-->
<style>
.links{margin:10px;}
.content{margin:20px ; width:42%; height:500px; padding:20px; overflow:auto; -webkit-border-radius:3px; -moz-border-radius:3px; border-radius:3px; float:left;}
.content p:nth-child(even){font-family:Georgia,serif; font-size:17px; font-style:italic;}
#content_1{background: silver;}
#content_1 p:nth-child(even){color:#999;}
#content_2{background: silver;}
#content_2 p:nth-child(even){color:#999;}
</style>
<!-- jQuery-plugin voor scrollen -->
<link rel="stylesheet" href="styles/jquery.mCustomScrollbar.css" type="text/css" />
</head>
<body>
<div class="main-container">
<?php include "include/header.inc.php" ; ?>
</div>
<div class="main-container">
</div>
<a href="ingelogd.php#bovenaan"><div class="vaste_tab_links">
<div class="tekst90graden">Terug</div>
</div></a>
<div class="main-container">
<div class="container1">
<br />
<br />
<article class="box2" id="home_featured21">
<p class="headertekst">Repetitieplanner</p>
<div class="regelhoogte25"></div>
<a id="bovenaan"></a>
<div class="box3" style="height: 650px;">
<div class="regelhoogte25"></div>
<!-- Hier komt de content -->
<div id="content_1" class="content">
<p class="headertekst">Bestaande planningen</p>
<div class="regelhoogte25"></div>
<table style="width: 400px; margin-left: 10px; border: none;">
<tr>
<td class="standaardtekst" style="width: 20px; border: none;">Dag</td>
<td class="standaardtekst" style="width: 100px; border: none;">Datum</td>
<td class="standaardtekst" style="width: 100px; border: none;">Lokatie</td>
<td class="standaardtekst" style="width: 50px;border: none;">Aanvang</td>
<td class="standaardtekst" style="width: 50px;border: none;">Einde</td>
<td class="standaardtekst" style="width: 50px;border: none;"></td>
<td class="standaardtekst" style="width: 50px;border: none;"></td>
</tr>
<?php
while($rowDatum = mysqli_fetch_array($cResultPlanning)) {
$DagVanDeWeek = date("w", strtotime($rowDatum['datum']));
$nSelectie = $rowDatum['id'];
?>
<tr>
<td class="standaardtekst" style="width: 20px; border: none;"><?php echo $aDagen[$DagVanDeWeek] ; ?></td>
<td class="standaardtekst" style="width: 100px;border: none;"><?php echo nederlandse_datum($rowDatum['datum']) ; ?></td>
<td class="standaardtekst" style="width: 100px;border: none;"><?php echo $rowDatum['lok'] ; ?></td>
<td class="standaardtekst" style="width: 50px;border: none;"><?php echo substr($rowDatum['aanvang'],0,5) ; ?></td>
<td class="standaardtekst" style="width: 50px;border: none;"><?php echo substr($rowDatum['einde'],0,5) ; ?></td>
<td class="standaardtekst" style="width: 50px;border: none;"><a href="repetitieplanner.php?id=<?php echo $nSelectie ; ?>#bovenaan"><img title="Wijzigen roosterdatum" src="images/edit.gif" /></a></td>
<td class="standaardtekst" style="width: 50px;border: none;"><img title="Verwijderen roosterdatum" src="images/delete.png" /></td>
</tr>
<?php } ?>
</table>
</div>
<div id="content_2" class="content">
<?php
if($lWijzigen == true) {
?>
<p class="headertekst">Wijzigen planning</p>
<form action="repetitieplanner.php#bovenaan" method="POST">
<table>
<tr>
<td>Gebruiker:</td>
<td>
<?php
mysqli_data_seek($cResultGebruiker,0);
while($rowGebruiker = mysqli_fetch_array($cResultGebruiker)){
if($rowGebruiker['waarde'] == $_SESSION['plangebruiker']) {
$lGebruiker = 'checked="checked"';
} else {
$lGebruiker = "";
}
?>
<input type="radio" name="gebruiker" <?php echo $lGebruiker ; ?> value="<?php echo $rowGebruiker['waarde'] ; ?>" /><?php echo $rowGebruiker['inhoud'] ; ?><br />
<?php } ?>
</td>
</tr>
<tr>
<td>Datum:</td>
<td><input name="datum" type="date" value="<?php echo $rowPlan['datum'] ; ?>" /></td>
</tr>
<tr>
<td>Aanvang:</td>
<td><input name="aanvang" type="time" value="<?php echo $rowPlan['aanvang'] ; ?>" /></td>
</tr>
<tr>
<td>Einde:</td>
<td><input name="einde" type="time" value="<?php echo $rowPlan['einde'] ; ?>" /></td>
</tr>
<tr>
<td>Lokatie:</td>
<td>
<?php
mysqli_data_seek($cResultLokatie,0);
while($rowLokatie = mysqli_fetch_array($cResultLokatie)){
if($rowLokatie['waarde'] == $_SESSION['planlokatie']) {
$lLokatie = 'checked="checked"';
} else {
$lLokatie = "";
}
?>
<input type="radio" name="lokatie" <?php echo $lLokatie ; ?> value="<?php echo $rowLokatie['waarde'] ; ?>" /><?php echo $rowLokatie['inhoud'] ; ?><br />
<?php } ?>
</td>
</tr>
<tr>
<td>Toelichting:</td>
<td>
<textarea name="tekst"><?php echo $rowPlan['omschrijving'] ; ?></textarea>
</td>
</tr>
</table>
<p class="midden"><input type="submit" name="submit" value="<?php echo $cKnopTekst01 ; ?>" /></p>
</form>
<?php } ?>
</div>
<div class="regelhoogte25"></div>
<div class="regelhoogte25"></div>
<!-- Einde content -->
</div>
<div class="clear"></div>
</article>
</div>
<br />
<br />
<div class="container2">
</div>
</div>
<div class="main-container">
</div>
<?php include "include/footer.inc.php" ; ?>
<!-- custom scrollbars plugin -->
<script src="scripts/jquery.mCustomScrollbar.concat.min.js"></script>
<script>
(function($){
$(window).load(function(){
$("#content_1").mCustomScrollbar({
scrollButtons:{
enable:true
}
});
$("#content_2").mCustomScrollbar({
scrollButtons:{
enable:true
}
});
$("#content_3").mCustomScrollbar({
scrollButtons:{
enable:true
}
});
});
})(jQuery);
</script>
</body>
</html>
/**
* @author George van Baasbank
* @package Podiumspektakel
* @subpackage repetitieplanner
* @copyright Ermelo Software
* @since 05-06-2014
* bestandsnaam repetitieplanner.php
* beschrijving Module om repetities te plannen
* opmerking
* taalmodule
* e-mail [email protected]
* project Podiumspektakel
* Tijdstempel // <!-- phpDesigner :: Timestamp [6/8/2014 12:47:28 PM] -->
*
*/
/**
* Wijzigingslog
*
* Datum Developer Aanpassing
* 05-06-2014 George Ontwikkeling
*
*/
session_start();
error_reporting(0);
require_once "include/pod_config.inc.php";
include "include/systeem.inc.php";
include "functies/functiebieb.inc.php";
// Declaratie variabelen
$lWijzigen = false;
$cKnopTekst01 = "Wijzigen";
// Geindexeerde array met dagen
$aDagen = array (
0 => 'zo',
'ma',
'di',
'wo',
'do',
'vr',
'za',
);
// Inlezen bestaande planningen en gegevens
include "include/connectie.inc.php";
// Bestaande planning
include "queries/sql_sel_rooster.php";
$cResultPlanning = mysqli_query($verbinding,$sql);
// Beschikbare lokaties
include "queries/sql_sel_lokatie.php";
$cResultLokatie = mysqli_query($verbinding,$sql);
// Beschikbare gebruikers
include "queries/sql_sel_gebruiker.php";
$cResultGebruiker = mysqli_query($verbinding,$sql);
mysqli_close($verbinding);
if($_SERVER['REQUEST_METHOD'] === 'POST') {
$cActie = $_POST['submit'];
$nRecord = $_SESSION['recordnr'];
if($cActie == $cKnopTekst01) { // Wijzigen planning
include "include/connectie.inc.php";
$cGebruiker = $_POST['gebruiker'];
$dDatum = $_POST['datum'];
$cAanvang = $_POST['aanvang'];
$cEinde = $_POST['einde'];
$cLokatie = $_POST['lokatie'];
$cTekst = mysqli_real_escape_string($verbinding,$_POST['tekst']);
$sql = "UPDATE pod__rooster SET datum = '$dDatum', aanvang = '$cAanvang', einde = '$cEinde', lokatie = '$cLokatie', gebruiker = '$cGebruiker', omschrijving = '$cTekst', mutatie = 'George' WHERE id = '$nRecord'";
echo $sql;
$cResultWijziging = mysqli_query($verbinding,$sql);
mysqli_close($verbinding);
}
}
if($_GET['id']) {
$nRecord = $_GET['id'];
$_SESSION['recordnr'] = $nRecord;
$lWijzigen = true;
include "include/connectie.inc.php";
$sql = "SELECT pr.*,ss.inhoud AS lok FROM pod__rooster AS pr JOIN sys__select AS ss ON ss.waarde = pr.lokatie WHERE pr.id = '$nRecord'";
echo $sql;
$cResultPlan = mysqli_query($verbinding,$sql);
$rowPlan = mysqli_fetch_array($cResultPlan);
$_SESSION['plangebruiker'] = $rowPlan['gebruiker'];
$_SESSION['planlokatie'] = $rowPlan['lokatie'];
mysqli_close($verbinding);
}
?>
<!DOCTYPE html>
<html lang="nl">
<head>
<title>Repetitiepplanner | Podiumspektakel 2015</title>
<meta charset="utf-8" />
<meta http-equiv="content-type" content="text/html" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="robots" content="noindex,nofollow" />
<meta name="googlebot" content="noodp, noarchive, nosnippet, noindex, nofollow" />
<meta name="keywords" content="<?php echo $cMetaKeywords ; ?>" />
<meta name="author" content="<?php echo $cMetaAuteur ; ?>" />
<meta name="description" content="<?php echo $cMetaDescription ; ?>" />
<meta name="copyright" content="Ermelo Software 2014" />
<link rel="stylesheet" href="styles/elegant-press.css" type="text/css" />
<script src="scripts/elegant-press.js" type="text/javascript"></script>
<!--[if IE]><style>#header h1 a:hover{font-size:75px;}</style><![endif]-->
<style>
.links{margin:10px;}
.content{margin:20px ; width:42%; height:500px; padding:20px; overflow:auto; -webkit-border-radius:3px; -moz-border-radius:3px; border-radius:3px; float:left;}
.content p:nth-child(even){font-family:Georgia,serif; font-size:17px; font-style:italic;}
#content_1{background: silver;}
#content_1 p:nth-child(even){color:#999;}
#content_2{background: silver;}
#content_2 p:nth-child(even){color:#999;}
</style>
<!-- jQuery-plugin voor scrollen -->
<link rel="stylesheet" href="styles/jquery.mCustomScrollbar.css" type="text/css" />
</head>
<body>
<div class="main-container">
<?php include "include/header.inc.php" ; ?>
</div>
<div class="main-container">
</div>
<a href="ingelogd.php#bovenaan"><div class="vaste_tab_links">
<div class="tekst90graden">Terug</div>
</div></a>
<div class="main-container">
<div class="container1">
<br />
<br />
<article class="box2" id="home_featured21">
<p class="headertekst">Repetitieplanner</p>
<div class="regelhoogte25"></div>
<a id="bovenaan"></a>
<div class="box3" style="height: 650px;">
<div class="regelhoogte25"></div>
<!-- Hier komt de content -->
<div id="content_1" class="content">
<p class="headertekst">Bestaande planningen</p>
<div class="regelhoogte25"></div>
<table style="width: 400px; margin-left: 10px; border: none;">
<tr>
<td class="standaardtekst" style="width: 20px; border: none;">Dag</td>
<td class="standaardtekst" style="width: 100px; border: none;">Datum</td>
<td class="standaardtekst" style="width: 100px; border: none;">Lokatie</td>
<td class="standaardtekst" style="width: 50px;border: none;">Aanvang</td>
<td class="standaardtekst" style="width: 50px;border: none;">Einde</td>
<td class="standaardtekst" style="width: 50px;border: none;"></td>
<td class="standaardtekst" style="width: 50px;border: none;"></td>
</tr>
<?php
while($rowDatum = mysqli_fetch_array($cResultPlanning)) {
$DagVanDeWeek = date("w", strtotime($rowDatum['datum']));
$nSelectie = $rowDatum['id'];
?>
<tr>
<td class="standaardtekst" style="width: 20px; border: none;"><?php echo $aDagen[$DagVanDeWeek] ; ?></td>
<td class="standaardtekst" style="width: 100px;border: none;"><?php echo nederlandse_datum($rowDatum['datum']) ; ?></td>
<td class="standaardtekst" style="width: 100px;border: none;"><?php echo $rowDatum['lok'] ; ?></td>
<td class="standaardtekst" style="width: 50px;border: none;"><?php echo substr($rowDatum['aanvang'],0,5) ; ?></td>
<td class="standaardtekst" style="width: 50px;border: none;"><?php echo substr($rowDatum['einde'],0,5) ; ?></td>
<td class="standaardtekst" style="width: 50px;border: none;"><a href="repetitieplanner.php?id=<?php echo $nSelectie ; ?>#bovenaan"><img title="Wijzigen roosterdatum" src="images/edit.gif" /></a></td>
<td class="standaardtekst" style="width: 50px;border: none;"><img title="Verwijderen roosterdatum" src="images/delete.png" /></td>
</tr>
<?php } ?>
</table>
</div>
<div id="content_2" class="content">
<?php
if($lWijzigen == true) {
?>
<p class="headertekst">Wijzigen planning</p>
<form action="repetitieplanner.php#bovenaan" method="POST">
<table>
<tr>
<td>Gebruiker:</td>
<td>
<?php
mysqli_data_seek($cResultGebruiker,0);
while($rowGebruiker = mysqli_fetch_array($cResultGebruiker)){
if($rowGebruiker['waarde'] == $_SESSION['plangebruiker']) {
$lGebruiker = 'checked="checked"';
} else {
$lGebruiker = "";
}
?>
<input type="radio" name="gebruiker" <?php echo $lGebruiker ; ?> value="<?php echo $rowGebruiker['waarde'] ; ?>" /><?php echo $rowGebruiker['inhoud'] ; ?><br />
<?php } ?>
</td>
</tr>
<tr>
<td>Datum:</td>
<td><input name="datum" type="date" value="<?php echo $rowPlan['datum'] ; ?>" /></td>
</tr>
<tr>
<td>Aanvang:</td>
<td><input name="aanvang" type="time" value="<?php echo $rowPlan['aanvang'] ; ?>" /></td>
</tr>
<tr>
<td>Einde:</td>
<td><input name="einde" type="time" value="<?php echo $rowPlan['einde'] ; ?>" /></td>
</tr>
<tr>
<td>Lokatie:</td>
<td>
<?php
mysqli_data_seek($cResultLokatie,0);
while($rowLokatie = mysqli_fetch_array($cResultLokatie)){
if($rowLokatie['waarde'] == $_SESSION['planlokatie']) {
$lLokatie = 'checked="checked"';
} else {
$lLokatie = "";
}
?>
<input type="radio" name="lokatie" <?php echo $lLokatie ; ?> value="<?php echo $rowLokatie['waarde'] ; ?>" /><?php echo $rowLokatie['inhoud'] ; ?><br />
<?php } ?>
</td>
</tr>
<tr>
<td>Toelichting:</td>
<td>
<textarea name="tekst"><?php echo $rowPlan['omschrijving'] ; ?></textarea>
</td>
</tr>
</table>
<p class="midden"><input type="submit" name="submit" value="<?php echo $cKnopTekst01 ; ?>" /></p>
</form>
<?php } ?>
</div>
<div class="regelhoogte25"></div>
<div class="regelhoogte25"></div>
<!-- Einde content -->
</div>
<div class="clear"></div>
</article>
</div>
<br />
<br />
<div class="container2">
</div>
</div>
<div class="main-container">
</div>
<?php include "include/footer.inc.php" ; ?>
<!-- custom scrollbars plugin -->
<script src="scripts/jquery.mCustomScrollbar.concat.min.js"></script>
<script>
(function($){
$(window).load(function(){
$("#content_1").mCustomScrollbar({
scrollButtons:{
enable:true
}
});
$("#content_2").mCustomScrollbar({
scrollButtons:{
enable:true
}
});
$("#content_3").mCustomScrollbar({
scrollButtons:{
enable:true
}
});
});
})(jQuery);
</script>
</body>
</html>
Gewijzigd op 08/06/2014 13:01:55 door George van Baasbank
Not...
Probeer het zelf eens te vinden, door om de zoveel regels gewoon even een echo te geven van de variabele die volgens jou verkeerd gaat. Zie je vanzelf waar de waarde niet meer klopt, weet je ook waar je het zoeken moet. Dat is voor jou heel simpel te doen, voor ons onmogelijk.
Het probleem zit (volgens mij) ergens in het php-deel. De html-code is wellicht niet nodig
Toevoeging op 08/06/2014 13:17:57:
Voor de belangstellenden: http://www.podiumspektakel.eu/repetitieplanner.php#bovenaan
Hier kan vrijuit worden getest.
Gewijzigd op 08/06/2014 13:19:18 door George van Baasbank
Heb de code proberen te lezen/begrijpen, maar ik zie vooral veel onnodige variabelen die aangemaakt worden, waardoor je code onnodig lang wordt (en onoverzichtelijk).
Wat is het nut van regel 66 / 67? Je kunt toch in 1x controleren of een formulier is verzonden en of $_POST['submit'] gelijk is aan wijzigen?
De variabele $nRecord lijkt me ook wat overbodig, net als alle nieuwe variabelen op regel 72 / 77.
regel 86 / 88 :
Je controleert nergens of id wel een getal is (wat ik vermoed dat het moet zijn)
Je maakt een variabele $nRecord aan; waarom?
Waarom een vage variabele als $cKnopTekst01?
Mijn vermoeden is dat de waarde in de sessie niet is wat jij verwacht. Maar door te gaan debuggen zul je daar zelf achter moeten komen.
Op regel 93 komt het id uit een GET.
Dat is fout.
Wat als iemand een pagina ophaalt voor id=1. In de sessie staat nu 1.
Vervolgens, in een andere tab haalt dezelfde persoon een pagina op voor id=2. In de sessie staat nu 2, 1 is overschreven.
Vervolgens past die gebruiker iets aan in de eerste pagina, id=1 dus. Maar in je sessie staat 2....
Logica aanpassen dus en dit niet op deze manier proberen op te lossen. Kost je alleen maar tijd.
Naast alle opmerkingen die ik gekregen heb wil ik graag deze even met je doornemen:
Quote:
Wat als iemand een pagina ophaalt voor id=1. In de sessie staat nu 1.
Vervolgens, in een andere tab haalt dezelfde persoon een pagina op voor id=2. In de sessie staat nu 2, 1 is overschreven.
Vervolgens past die gebruiker iets aan in de eerste pagina, id=1 dus. Maar in je sessie staat 2....
Vervolgens, in een andere tab haalt dezelfde persoon een pagina op voor id=2. In de sessie staat nu 2, 1 is overschreven.
Vervolgens past die gebruiker iets aan in de eerste pagina, id=1 dus. Maar in je sessie staat 2....
Omdat ik probeer te leren uit alle fouten vind ik deze wel belangrijk. Hoe kan ik het geschetste probleem voorkomen?
Gewijzigd op 08/06/2014 16:09:48 door George van Baasbank
(note: check wel altijd of de GET parameter bestaat, dat heb ik voor de duidelijkheid even weggelaten)
Code (php)
Op de manier kan een gebruiker alle pagina's tegelijk open hebben, maar weet je altijd precies welke hij probeert te bewerken.
Gewijzigd op 08/06/2014 16:18:31 door Erwin H
Waarom 3x een connectie met de database openen en sluiten?