hoi ik ben bezig met een opdracht maar krijg hem niet werkend
de bedoeling is dat het een crud wordt met php
en ik heb nu al dit
dit is de betreffende foutmelding:
Fatal error: Uncaught PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'order clause' in C:\Users\melis\Desktop\CMS\xammp\htdocs\CRUD\index.php:60 Stack trace: #0 C:\Users\melis\Desktop\CMS\xammp\htdocs\CRUD\index.php(60): PDOStatement->execute() #1 {main} thrown in C:\Users\melis\Desktop\CMS\xammp\htdocs\CRUD\index.php on line 60
ik weet niet waar het probleem zit kan iemand mij helpen
de bedoeling is dat het een crud wordt met php
en ik heb nu al dit
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
| <!Doc<!Doctype html> <html lang="nl"> <head> <meta http-equiv="Content-Type" content="text/html"; charset="UTF-8"/> <title></title> <?php require_once 'Crud.php';?> </head> <body> <div class="panel"> <form method="post"> <table border="1" width="40%" cellpadding="15" class="table table-bordered"> <tr> <td><input type="text" name="KLANTNR" placeholder="KLANTNR" required="" value="<?php if(isset($_GET['edit_id'])){ print($editRow['KLANTNR']); } ?>" /></td> </tr> <tr> <td><input type="text" name="VOORNAAM" placeholder="VOORNAAM" required="" value="<?php if(isset($_GET['edit_id'])){ print($editRow['VOORNAAM']); } ?>" /></td> </tr> <tr> <td><input type="text" name="ACHTERNAAM" placeholder="ACHTERNAAM" required="" value="<?php if(isset($_GET['edit_id'])){ print($editRow['ACHTERNAAM']); } ?>" /></td> </tr> <tr> <td><input type="text" name="ADRES" placeholder="ADRES" required="" value="<?php if(isset($_GET['edit_id'])){ print($editRow['ADRES']); } ?>" /></td> </tr> <tr> <td><input type="text" name="POSTCODE" placeholder="POSTCODE" required="" value="<?php if(isset($_GET['edit_id'])){ print($editRow['POSTCODE']); } ?>" /></td> </tr> <tr> <td><input type="text" name="WOONPLAATS" placeholder="WOONPLAATS" required="" value="<?php if(isset($_GET['edit_id'])){ print($editRow['WOONPLAATS']); } ?>" /></td> </tr> <tr> <td><input type="text" name="PROVINCIE" placeholder="PROVINCIE" required="" value="<?php if(isset($_GET['edit_id'])){ print($editRow['PROVINCIE']); } ?>" /></td> </tr> <tr> <td><input type="text" name="TELEFOON" placeholder="TELEFOON" required="" value="<?php if(isset($_GET['edit_id'])){ print($editRow['TELEFOON']); } ?>" /></td> </tr> <tr> <td> <?php if(isset($_GET['edit_id'])){ ?> <button type="submit" name="update" class="btn btn-warning">update</button> <?php } else { ?> <button type="submit" name="save" class="btn btn-success">save</button> <?php } ?> </td> </tr> </table> </form> <br /> <?php $stmt = $DBcon->prepare("SELECT * FROM klanten ORDER BY id DESC"); $stmt->execute(); ?> <table border="1" width="40%" class="table table-bordered"> <thead> <tr> <td>KLANTNR</td> <td>VOORNAAM</td> <td>ACHTERNAAM</td> <td>ADRES</td> <td>POSTCODE</td> <td>WOONPLAATS</td> <td>PROVINCIE</td> <td>TELEFOON</td> <td>Update</td> <td>Delete</td> </tr> </thead> <?php if($stmt->rowCount() > 0) { while($row=$stmt->FETCH(PDO::FETCH_ASSOC)) { ?> <tr> <td><?php print($row['KLANTNR']); ?></td> <td><?php print($row['VOORNAAM']); ?></td> <td><?php print($row['ACHTERNAAM']); ?></td> <td><?php print($row['ADRES']); ?></td> <td><?php print($row['POSTCODE']); ?></td> <td><?php print($row['WOONPLAATS']); ?></td> <td><?php print($row['PROVINCIE']); ?></td> <td><?php print($row['TELEFOON']); ?></td> <td><a onclick="return confirm('Sure to Edit ? ')" href="index.php?edit_id=<?php print($row['id']); ?>">EDIT</a></td> <td><a onclick="return confirm('Sure to Delete ? ')" href="index.php?delete_id=<?php print($row['id']); ?>">DELETE</a></td> </tr> <?php } } else { ?> <tr> <td><?php print("nothing here..."); ?></td> </tr> <?php } ?> </table> </div> </body> </html> |
dit is de betreffende foutmelding:
Fatal error: Uncaught PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'order clause' in C:\Users\melis\Desktop\CMS\xammp\htdocs\CRUD\index.php:60 Stack trace: #0 C:\Users\melis\Desktop\CMS\xammp\htdocs\CRUD\index.php(60): PDOStatement->execute() #1 {main} thrown in C:\Users\melis\Desktop\CMS\xammp\htdocs\CRUD\index.php on line 60
ik weet niet waar het probleem zit kan iemand mij helpen