update query werkt niet
$Ugeneral = mysql_query('UPDATE general SET Birthday="'.$Ubirthday.'", Place="'.$Uplace.'", Known_off="'.$Ugroup.'", WHERE ID="'.$Uid.'"');
Alle velden behalve $Uid komen vanuit een html form. de waarde van $uid komt vanuit de db...
Probeer:
werkt ook niet...
Laat je database structuur is zijn, en evt. wat code van je form-> php.
Kijk eens wat er in je $vars zit.
DB structuur:
ID | Name | Birthday | Age | Place | Known_off
Als volgend is het html form opgebouwd:
<td>Birthday</td>
<td><input type="text" name="birthday" value="" /></td>
waarbij dus de name en $..... wordt vervangen door een ander.
Oftewel de gegevens die in de db staan worden weergegeven in een html form waarbij je dus kunt aanpassen en vervolgens op update kan klikken om de waardes uptedaten
Tevens, wat zijn de punten in value, ik doe al een poos SQL maar nog nooit gezien. (.$value.)
Moet het dan toch UPDATE general SET Place='$Uplace' worden...
$Uid wordt via een select query uit de table general gehaald where Name is van het invoervak.
Toevoeging op 26/02/2011 13:57:36:
of bedoel je de puntjes in mijn vorige post warbij ik zei dat $.... kan veranderen
... staat voor een andere variabele!
Toon je volledig stukje code is: vanaf de form tot aan je query afhandeling.
Toevoeging op 26/02/2011 14:31:57:
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
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
<?php
include ("/includes/connect.php");
if(isset($_POST["submitKnop"]))
{
$Qgeneral = mysql_query("SELECT * FROM general WHERE Name = '".$_POST["inputIsbn"]."' ");
//verder gegevens ophalen uit de DB
while ($row2 = mysql_fetch_assoc($Qgeneral)) {
$name = $row2['Name'];
$place = $row2['Place'];
$id = $row2['ID'];
$birth = $row2['Birthday'];
$group = $row2['Known_off'];
}
$Qother = mysql_query("SELECT * FROM other_information WHERE Name = '".$_POST["inputIsbn"]."' ");
while ($row1 = mysql_fetch_assoc($Qother)) {
$email = $row1['Email'];
$telephone = $row1['Telephone'];
$mobile = $row1['Mobile_phone'];
}
$Qpatient = mysql_query("SELECT * FROM patient_information WHERE Name = '".$_POST["inputIsbn"]."' ");
while ($row = mysql_fetch_assoc($Qpatient)) {
$length = $row['Length'];
$weight = $row['Weight'];
$penislength = $row['Penis_length'];
$penisthickness = $row['Penis_thickness'];
}
}
if (isset($_POST['action'])) {
// Uit te voeren actie bepalen:
$action = $_POST['action'];
if ($action ==="Update") {
$Uname = $_POST['inputIsbn'];
$Uemail = $_POST['email'];
$Uplace = $_POST['place'];
$Ubirthday = $_POST['birthday'];
$Utelephone = $_POST['telephone'];
$Umobile = $_POST['mobile'];
$Ugroup = $_POST['group'];
$Ulength = $_POST['length'];
$Uweight = $_POST['weight'];
$Upenisl = $_POST['penis_length'];
$Upenist = $_POST['penis_thickness'];
$QUgeneral = mysql_query("SELECT * FROM general WHERE Name = '".$_POST["inputIsbn"]."' ");
//verder gegevens ophalen uit de DB
while ($res1 = mysql_fetch_assoc($QUgeneral)) {
$Uid = $res1['ID'];
}
$Ugeneral = mysql_query( " UPDATE general
SET Birthday = '$Ubirthday',
Name = ''".$_POST["inputIsbn"]."'',
Age = '',
Place = '$Uplace',
Known_off = '$Ugroup'
WHERE ID = '$Uid'");
$Ugeneral = mysql_query( " UPDATE other_information
SET Email = '$Uemail'
Telephone = '$Utelephone'
Mobile_phone = '$Umobile'
WHERE ID = '$Uid'");
$Ugeneral = mysql_query( " UPDATE patient_information
SET Length = '$Ulength'
Weight = '$Uweight'
Penis_length = '$Upenisl'
Penis_thickness = '$Upenist'
WHERE ID = '$Uid'");
}
}
?>
include ("/includes/connect.php");
if(isset($_POST["submitKnop"]))
{
$Qgeneral = mysql_query("SELECT * FROM general WHERE Name = '".$_POST["inputIsbn"]."' ");
//verder gegevens ophalen uit de DB
while ($row2 = mysql_fetch_assoc($Qgeneral)) {
$name = $row2['Name'];
$place = $row2['Place'];
$id = $row2['ID'];
$birth = $row2['Birthday'];
$group = $row2['Known_off'];
}
$Qother = mysql_query("SELECT * FROM other_information WHERE Name = '".$_POST["inputIsbn"]."' ");
while ($row1 = mysql_fetch_assoc($Qother)) {
$email = $row1['Email'];
$telephone = $row1['Telephone'];
$mobile = $row1['Mobile_phone'];
}
$Qpatient = mysql_query("SELECT * FROM patient_information WHERE Name = '".$_POST["inputIsbn"]."' ");
while ($row = mysql_fetch_assoc($Qpatient)) {
$length = $row['Length'];
$weight = $row['Weight'];
$penislength = $row['Penis_length'];
$penisthickness = $row['Penis_thickness'];
}
}
if (isset($_POST['action'])) {
// Uit te voeren actie bepalen:
$action = $_POST['action'];
if ($action ==="Update") {
$Uname = $_POST['inputIsbn'];
$Uemail = $_POST['email'];
$Uplace = $_POST['place'];
$Ubirthday = $_POST['birthday'];
$Utelephone = $_POST['telephone'];
$Umobile = $_POST['mobile'];
$Ugroup = $_POST['group'];
$Ulength = $_POST['length'];
$Uweight = $_POST['weight'];
$Upenisl = $_POST['penis_length'];
$Upenist = $_POST['penis_thickness'];
$QUgeneral = mysql_query("SELECT * FROM general WHERE Name = '".$_POST["inputIsbn"]."' ");
//verder gegevens ophalen uit de DB
while ($res1 = mysql_fetch_assoc($QUgeneral)) {
$Uid = $res1['ID'];
}
$Ugeneral = mysql_query( " UPDATE general
SET Birthday = '$Ubirthday',
Name = ''".$_POST["inputIsbn"]."'',
Age = '',
Place = '$Uplace',
Known_off = '$Ugroup'
WHERE ID = '$Uid'");
$Ugeneral = mysql_query( " UPDATE other_information
SET Email = '$Uemail'
Telephone = '$Utelephone'
Mobile_phone = '$Umobile'
WHERE ID = '$Uid'");
$Ugeneral = mysql_query( " UPDATE patient_information
SET Length = '$Ulength'
Weight = '$Uweight'
Penis_length = '$Upenisl'
Penis_thickness = '$Upenist'
WHERE ID = '$Uid'");
}
}
?>
<table>
<tr>
<td>ID</td>
<td></td>
</tr>
<tr>
<td><form name="inputForm" method="post" action="form.php">
<label for="inputIsbn">Name</label> </td>
<td><input type="text" name="inputIsbn" value=""/></td>
<td><input type="submit" name="submitKnop" value="OK" /></td>
</form>
<form name="form2" method="post" action="form.php">
<tr>
<td>Place</td>
<td><input type="text" name="place" value="" /></td>
</tr>
<tr>
<td>Birthday</td>
<td><input type="text" name="birthday" value="" /></td>
</tr>
<tr>
<td>Group</td>
<td><input type="text" name="group" value="" /></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="email" value="" /></td>
</tr>
<tr>
<td>Telephone</td>
<td><input type="text" name="telephone" value="" /></td>
</tr>
<tr>
<td> Mobile</td>
<td><input type="text" name="mobile" value="" /></td>
</tr>
<tr>
<td>Length</td>
<td><input type="text" name="length" value="" /></td>
</tr>
<tr>
<td>Weight</td>
<td><input type="text" name="weight" value="" /></td>
</tr>
<tr>
<td>Penis length</td>
<td><input type="text" name="penis_length" value="" /></td>
</tr>
<tr>
<td>Penis thickness</td>
<td><input type="text" name="penis_thickness" value="" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="action" value="Update">
</form></table><P>
Go to the <a href="http://localhost/medical/index.php">Index page</a><br>
Go to the <a href="http://localhost/medical/patient_card.php">Patient card</a><br>
Go to the <a href="http://localhost/medical/search.php">Search page</a><br>