Update probleem
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
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
<?php
include ("config.php");
$id = $_REQUEST['id'];
$result = mysql_query("SELECT * FROM war WHERE id='$id'");
while($row = mysql_fetch_array($result)){
echo "
<form name='form' method='post' >
<table width='80%' border='0' cellspacing='3' cellpadding='0'>
<tr>
<td width='20%'>Clan:</td>
<td width='79%'><input name='tag' type='text' id='tag' value='".$row['tags']."' size='40' maxlength='40' /></td>
</tr>
<tr>
<td>Server Name:</td>
<td><input name='server' type='text' id='server' value='".$row['server']."' size='40' maxlength='40' /></td>
</tr>
<tr>
<td>Rounds:</td>
<td><input name='rounds' type='text' id='rounds' value='".$row['title']."' size='5' maxlength='40' /> </td>
</tr>
<tr>
<td>Type:</td>
<td><select name='type' id='type'>
<option value='CS: Hotages' selected='selected'>CS: Hotages</option>
<option value='DE: Defuse'>DE: Defuse</option>
<option value='GG: GunGame'>GG: GunGame</option>
<option value='Surf'>Surf</option>
</select></td>
</tr>
<tr>
<td>Map:</td>
<td><label>
<select name='map' id='map'>
<option value='de_dust.jpg'>Dust 1</option>
<option value='de_dust2.jpg'>Dust 2</option>
</select>
</label></td>
</tr>
<tr>
<td>Server IP : </td>
<td><input name='ip' type='text' id='ip'
value='".$row['ip']."' size='40' /></td>
</tr>
<tr>
<td>Date:</td>
<td><select name='date1' id='date1'>
<option value='' selected='selected'>---</option>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
<option value='5'>5</option>
<option value='6'>6</option>
<option value='7'>7</option>
<option value='8'>8</option>
<option value='9'>9</option>
<option value='10'>10</option>
<option value='11'>11</option>
<option value='12'>12</option>
<option value='13'>13</option>
<option value='14'>14</option>
<option value='15'>15</option>
<option value='16'>16</option>
<option value='17'>17</option>
<option value='18'>18</option>
<option value='19'>19</option>
<option value='20'>20</option>
<option value='21'>21</option>
<option value='22'>22</option>
<option value='23'>23</option>
<option value='24'>24</option>
<option value='25'>25</option>
<option value='26'>26</option>
<option value='27'>27</option>
<option value='28'>28</option>
<option value='29'>29</option>
<option value='30'>30</option>
<option value='31'>31</option>
</select>
<select name='date2' id='date2'>
<option value='' selected='selected'>---</option>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
<option value='5'>5</option>
<option value='6'>6</option>
<option value='7'>7</option>
<option value='8'>8</option>
<option value='9'>9</option>
<option value='10'>10</option>
<option value='11'>11</option>
<option value='12'>12</option>
</select>
<select name='date3' id='date3'>
<option value='' selected='selected'>------</option>
<option value='2007'>2007</option>
<option value='2008'>2008</option>
<option value='2009'>2009</option>
<option value='2010'>2010</option>
<option value='2011'>2011</option>
<option value='2012'>2012</option>
</select></td>
</tr>
<tr>
<td>Time:</td>
<td>
<input name='hour1' type='text' id='hour1' value='".$row['hour']."' size='20' maxlength='40'></td>
</tr>
<tr>
<td>Players:</td>
<td><input name='pl1' type='text' id='pl1' value='".$row['players']."' size='20' maxlength='40' /></td>
</tr>
<tr>
<td>Score:</td>
<td>
<input name='score1' type='text' id='score1' value='".$row['score1']."' size='10' maxlength='10'>
:
<input name='score2' type='text' id='score2' value='".$row['score2']."' size='10' maxlength='10'></td>
</tr>
<tr>
<td>Comment</td>
<td><textarea name='comment' cols='65' rows='10'>".$row['title']."</textarea></td>
</tr>
<tr>
<td><input name='submit' type='submit' id='submit' value='Submit'>
<input name='reset' type='reset' id='reset' value='Reset'></td>
<td> </td>
</tr>
</table>
</form>
";
if ($_POST['submit']) {
$tags = $row['tags'];
$server = $row['server'];
$rounds = $row['rounds'];
$type = $row['type'];
$map = $row['map'];
$ip = $row['ip'];
$date = $row['date'];
$hour = $row['hour'];
$players = $row['players'];
$score1 = $row['score1'];
$score2 = $row['score2'];
$comment = $row['comment'];
mysql_query("UPDATE war SET tags='$tags',server='$server',rounds='$rounds',type='$type',map='$map',ip='$ip',date='$date',hour='$hour',players='$players',score1='$score1',score2='$score2',comment='$comment' WHERE id = '$id'") or die("Sorry, it failed");
echo "Success! Your tutorial has been edited.<br>";
}
}
?>
include ("config.php");
$id = $_REQUEST['id'];
$result = mysql_query("SELECT * FROM war WHERE id='$id'");
while($row = mysql_fetch_array($result)){
echo "
<form name='form' method='post' >
<table width='80%' border='0' cellspacing='3' cellpadding='0'>
<tr>
<td width='20%'>Clan:</td>
<td width='79%'><input name='tag' type='text' id='tag' value='".$row['tags']."' size='40' maxlength='40' /></td>
</tr>
<tr>
<td>Server Name:</td>
<td><input name='server' type='text' id='server' value='".$row['server']."' size='40' maxlength='40' /></td>
</tr>
<tr>
<td>Rounds:</td>
<td><input name='rounds' type='text' id='rounds' value='".$row['title']."' size='5' maxlength='40' /> </td>
</tr>
<tr>
<td>Type:</td>
<td><select name='type' id='type'>
<option value='CS: Hotages' selected='selected'>CS: Hotages</option>
<option value='DE: Defuse'>DE: Defuse</option>
<option value='GG: GunGame'>GG: GunGame</option>
<option value='Surf'>Surf</option>
</select></td>
</tr>
<tr>
<td>Map:</td>
<td><label>
<select name='map' id='map'>
<option value='de_dust.jpg'>Dust 1</option>
<option value='de_dust2.jpg'>Dust 2</option>
</select>
</label></td>
</tr>
<tr>
<td>Server IP : </td>
<td><input name='ip' type='text' id='ip'
value='".$row['ip']."' size='40' /></td>
</tr>
<tr>
<td>Date:</td>
<td><select name='date1' id='date1'>
<option value='' selected='selected'>---</option>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
<option value='5'>5</option>
<option value='6'>6</option>
<option value='7'>7</option>
<option value='8'>8</option>
<option value='9'>9</option>
<option value='10'>10</option>
<option value='11'>11</option>
<option value='12'>12</option>
<option value='13'>13</option>
<option value='14'>14</option>
<option value='15'>15</option>
<option value='16'>16</option>
<option value='17'>17</option>
<option value='18'>18</option>
<option value='19'>19</option>
<option value='20'>20</option>
<option value='21'>21</option>
<option value='22'>22</option>
<option value='23'>23</option>
<option value='24'>24</option>
<option value='25'>25</option>
<option value='26'>26</option>
<option value='27'>27</option>
<option value='28'>28</option>
<option value='29'>29</option>
<option value='30'>30</option>
<option value='31'>31</option>
</select>
<select name='date2' id='date2'>
<option value='' selected='selected'>---</option>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
<option value='5'>5</option>
<option value='6'>6</option>
<option value='7'>7</option>
<option value='8'>8</option>
<option value='9'>9</option>
<option value='10'>10</option>
<option value='11'>11</option>
<option value='12'>12</option>
</select>
<select name='date3' id='date3'>
<option value='' selected='selected'>------</option>
<option value='2007'>2007</option>
<option value='2008'>2008</option>
<option value='2009'>2009</option>
<option value='2010'>2010</option>
<option value='2011'>2011</option>
<option value='2012'>2012</option>
</select></td>
</tr>
<tr>
<td>Time:</td>
<td>
<input name='hour1' type='text' id='hour1' value='".$row['hour']."' size='20' maxlength='40'></td>
</tr>
<tr>
<td>Players:</td>
<td><input name='pl1' type='text' id='pl1' value='".$row['players']."' size='20' maxlength='40' /></td>
</tr>
<tr>
<td>Score:</td>
<td>
<input name='score1' type='text' id='score1' value='".$row['score1']."' size='10' maxlength='10'>
:
<input name='score2' type='text' id='score2' value='".$row['score2']."' size='10' maxlength='10'></td>
</tr>
<tr>
<td>Comment</td>
<td><textarea name='comment' cols='65' rows='10'>".$row['title']."</textarea></td>
</tr>
<tr>
<td><input name='submit' type='submit' id='submit' value='Submit'>
<input name='reset' type='reset' id='reset' value='Reset'></td>
<td> </td>
</tr>
</table>
</form>
";
if ($_POST['submit']) {
$tags = $row['tags'];
$server = $row['server'];
$rounds = $row['rounds'];
$type = $row['type'];
$map = $row['map'];
$ip = $row['ip'];
$date = $row['date'];
$hour = $row['hour'];
$players = $row['players'];
$score1 = $row['score1'];
$score2 = $row['score2'];
$comment = $row['comment'];
mysql_query("UPDATE war SET tags='$tags',server='$server',rounds='$rounds',type='$type',map='$map',ip='$ip',date='$date',hour='$hour',players='$players',score1='$score1',score2='$score2',comment='$comment' WHERE id = '$id'") or die("Sorry, it failed");
echo "Success! Your tutorial has been edited.<br>";
}
}
?>
Quote:
Sorry, it failed
Dat is ook wel een bijzonder duidelijke foutmelding! Wat dacht je van wat details, bv. mysql_error() ?
Tip: Gooi het hele script om, de volgorde lijkt nergens op.
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
enz.........
Maak een loop, bijvoorbeeld: for($i = 1; $i <= 31; $i++)
ja maar als ik bv die datum gwn in een text box plaats werkt dat nog niet