Database kollomen worden niet geupdate
(de index van de site is http://www.url.nl/dgl/index.php en als de pagina word geinclude is het ?page=update (staat in http://www.url.nl/dgl/user/update.php)
Weet iemand wat het probleem is?
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
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
<?
session_start();
include('controle.php');
include('connection.php');
if (isset($_POST['Update'])) {
$query="UPDATE users2 SET email='".$_POST['ud_email']."', achternaam='".$_POST['ud_achter']."', voornaam='".$_POST['ud_voor']."', irc='".$_POST['irc']."' WHERE id='".$_SESSION['id']."'";
mysql_query($query) or die ("Connectie mislukt!");
mysql_close();
echo "Gegevens zijn geupdate";
}
else
{
$query=" SELECT * FROM users2 WHERE id='".$_SESSION['id']."'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$voornaam=mysql_result($result,$i,"voornaam");
$achternaam=mysql_result($result,$i,"achternaam");
$gebruikersnaam=mysql_result($result,$i,"gebruikersnaam");
$email=mysql_result($result,$i,"email");
$clan=mysql_result($result,$i,"clan");
$irc=mysql_result($result,$i,"irc");
++$i;
}
?>
<span style="font-style: italic"></span>
<table width="531" border="0" cellpadding="0" cellspacing="0">
<tr>
<td></td>
</tr>
<tr>
<td><form action="?page=update" method="post">
<table width="531" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="45%"> Gebruikersnaam: </td>
<td width="55%"><? echo $gebruikersnaam; ?></td>
</tr>
</table></td>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="47%"> Clan: </td>
<td width="53%"><? if ($clan == '0'){echo "-";}else{echo $clan;} ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="50%">Voornnaam: </td>
<td width="50%"><input type="text" name="ud_voor" value="<? echo $voornaam; ?>" align="left"/>
</td>
</tr>
</table></td>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="50%">Achternaam: </td>
<td width="50%"><input type="text" name="ud_achter" value="<? echo $achternaam; ?>"/></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="50%">Email: </td>
<td width="50%"><input type="text" name="ud_email" value="<? echo $email; ?>"/></td>
</tr>
</table></td>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="50%">IRC-Channel:</td>
<td width="50%"><input type="text" name="irc" value="<? echo $irc; ?>"/></td>
</tr>
</table></td>
</tr>
<tr>
<td><input name="Update" type="Submit" value="Update" /></td>
<td> </td>
</tr>
</table>
</form></td>
</tr>
</table>
<?
}
?>
session_start();
include('controle.php');
include('connection.php');
if (isset($_POST['Update'])) {
$query="UPDATE users2 SET email='".$_POST['ud_email']."', achternaam='".$_POST['ud_achter']."', voornaam='".$_POST['ud_voor']."', irc='".$_POST['irc']."' WHERE id='".$_SESSION['id']."'";
mysql_query($query) or die ("Connectie mislukt!");
mysql_close();
echo "Gegevens zijn geupdate";
}
else
{
$query=" SELECT * FROM users2 WHERE id='".$_SESSION['id']."'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$voornaam=mysql_result($result,$i,"voornaam");
$achternaam=mysql_result($result,$i,"achternaam");
$gebruikersnaam=mysql_result($result,$i,"gebruikersnaam");
$email=mysql_result($result,$i,"email");
$clan=mysql_result($result,$i,"clan");
$irc=mysql_result($result,$i,"irc");
++$i;
}
?>
<span style="font-style: italic"></span>
<table width="531" border="0" cellpadding="0" cellspacing="0">
<tr>
<td></td>
</tr>
<tr>
<td><form action="?page=update" method="post">
<table width="531" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="45%"> Gebruikersnaam: </td>
<td width="55%"><? echo $gebruikersnaam; ?></td>
</tr>
</table></td>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="47%"> Clan: </td>
<td width="53%"><? if ($clan == '0'){echo "-";}else{echo $clan;} ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="50%">Voornnaam: </td>
<td width="50%"><input type="text" name="ud_voor" value="<? echo $voornaam; ?>" align="left"/>
</td>
</tr>
</table></td>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="50%">Achternaam: </td>
<td width="50%"><input type="text" name="ud_achter" value="<? echo $achternaam; ?>"/></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="50%">Email: </td>
<td width="50%"><input type="text" name="ud_email" value="<? echo $email; ?>"/></td>
</tr>
</table></td>
<td><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="50%">IRC-Channel:</td>
<td width="50%"><input type="text" name="irc" value="<? echo $irc; ?>"/></td>
</tr>
</table></td>
</tr>
<tr>
<td><input name="Update" type="Submit" value="Update" /></td>
<td> </td>
</tr>
</table>
</form></td>
</tr>
</table>
<?
}
?>
beide links gaan naar de hompage