Example: Deleting guests using mySQLi Object-oriented

Record deleted successfully

Here is the code for deleting the record from the database table.

<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "DBname";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}

// sql to delete a record
$sql = "DELETE FROM MyGuests WHERE id=3";

if ($conn->query($sql) === TRUE) {
  echo "Record deleted successfully";
} else {
  echo "Error deleting record: " . $conn->error;
}

$conn->close();
?>

After the record is deleted, the table will look like this:

IDNameEmailRegistrarion Date
1Don Jamesjohn@example.com2024-11-28 13:25:43
2Don Doejohn@example.com2024-11-28 14:34:54
4John Doejohn@deere.net2024-11-28 14:37:15
6Daisy Duckdaisyduck@example.com2024-11-28 13:41:22
7Julie Dooleyjuliedooley@example.com2024-11-28 13:41:22
8Bob Marleybobmarley@example.com2024-11-28 13:43:53
9Rita Marleyritamarley@example.com2024-11-28 13:43:53
10Peter Toshpetertosh@example.com2024-11-28 13:43:53
11Tom Cattc@example.com2024-11-28 13:49:32
12Woody Woodpeckerwoody@example.com2024-11-28 13:49:32
13Mighty Mousemighty@example.com2024-11-28 13:49:32
14Bob Marleybobmarley@example.com2024-12-05 06:36:51
15Rita Marleyritamarley@example.com2024-12-05 06:36:51
16Peter Toshpetertosh@example.com2024-12-05 06:36:51
17Tom Cattc@example.com2024-12-05 06:39:18
18Woody Woodpeckerwoody@example.com2024-12-05 06:39:18
19Mighty Mousemighty@example.com2024-12-05 06:39:18
20John Deerejohn@deere.net2024-12-05 06:39:22
21Don Jamesjohn@example.com2024-12-05 06:41:38
22Donald Duckdduckn@example.com2024-12-05 06:46:06
23Daisy Duckdaisyduck@example.com2024-12-05 06:46:06
24Julie Dooleyjuliedooley@example.com2024-12-05 06:46:06
25John Deerjohnd@example.com2024-12-05 06:57:02
26Don Jamesjohn@example.com2024-12-05 06:57:06
27John Deerjohnd@example.com2024-12-07 02:13:57
28John Deerejohn@deere.net2024-12-07 11:26:18
29John Deerjohnd@example.com2024-12-07 14:43:35
30Don Jamesjohn@example.com2024-12-07 21:24:41
31Donald Duckdduckn@example.com2024-12-07 21:37:50
32Daisy Duckdaisyduck@example.com2024-12-07 21:37:50
33Julie Dooleyjuliedooley@example.com2024-12-07 21:37:50
34Tom Cattc@example.com2024-12-07 22:10:43
35Woody Woodpeckerwoody@example.com2024-12-07 22:10:43
36Mighty Mousemighty@example.com2024-12-07 22:10:43
37Bob Marleybobmarley@example.com2024-12-08 01:08:15
38Rita Marleyritamarley@example.com2024-12-08 01:08:15
39Peter Toshpetertosh@example.com2024-12-08 01:08:15
40Don Jamesjohn@example.com2024-12-08 03:46:03
41Don Jamesjohn@example.com2024-12-13 22:34:50
42John Deerjohnd@example.com2024-12-13 22:39:14
43John Deerejohn@deere.net2024-12-13 22:40:02
44Don Jamesjohn@example.com2024-12-13 22:44:26
45Donald Duckdduckn@example.com2024-12-13 22:44:51
46Daisy Duckdaisyduck@example.com2024-12-13 22:44:51
47Julie Dooleyjuliedooley@example.com2024-12-13 22:44:51
48Tom Cattc@example.com2024-12-13 22:45:14
49Woody Woodpeckerwoody@example.com2024-12-13 22:45:15
50Mighty Mousemighty@example.com2024-12-13 22:45:15
51Bob Marleybobmarley@example.com2024-12-13 22:45:38
52Rita Marleyritamarley@example.com2024-12-13 22:45:38
53Peter Toshpetertosh@example.com2024-12-13 22:45:39
54John Deerjohnd@example.com2024-12-22 19:07:33
55John Deerejohn@deere.net2024-12-22 19:07:42
56Don Jamesjohn@example.com2024-12-22 19:08:12
57Don Jamesjohn@example.com2024-12-22 19:08:19
58Tom Cattc@example.com2024-12-22 19:17:05
59Woody Woodpeckerwoody@example.com2024-12-22 19:17:05
60Mighty Mousemighty@example.com2024-12-22 19:17:05
61Donald Duckdduckn@example.com2024-12-22 19:21:09
62Daisy Duckdaisyduck@example.com2024-12-22 19:21:09
63Julie Dooleyjuliedooley@example.com2024-12-22 19:21:09
64Bob Marleybobmarley@example.com2024-12-22 19:21:17
65Rita Marleyritamarley@example.com2024-12-22 19:21:17
66Peter Toshpetertosh@example.com2024-12-22 19:21:17
67John Deerjohnd@example.com2024-12-28 11:12:45
68John Deerejohn@deere.net2024-12-30 11:12:45
69Bob Marleybobmarley@example.com2024-12-30 15:50:59
70Rita Marleyritamarley@example.com2024-12-30 15:50:59
71Peter Toshpetertosh@example.com2024-12-30 15:50:59
72Donald Duckdduckn@example.com2024-12-30 17:12:49
73Daisy Duckdaisyduck@example.com2024-12-30 17:12:49
74Julie Dooleyjuliedooley@example.com2024-12-30 17:12:49
75John Deerejohn@deere.net2024-12-30 19:31:58
76Tom Cattc@example.com2024-12-30 20:23:19
77Woody Woodpeckerwoody@example.com2024-12-30 20:23:19
78Mighty Mousemighty@example.com2024-12-30 20:23:19
79Don Jamesjohn@example.com2024-12-30 20:26:27
80Bob Marleybobmarley@example.com2024-12-30 20:27:19
81Rita Marleyritamarley@example.com2024-12-30 20:27:19
82Peter Toshpetertosh@example.com2024-12-30 20:27:19
83John Deerjohnd@example.com2024-12-30 20:43:27
84Don Jamesjohn@example.com2024-12-30 20:54:12
85John Deerjohnd@example.com2025-01-03 21:31:26
86John Deerejohn@deere.net2025-01-03 21:37:56
87Don Jamesjohn@example.com2025-01-03 21:39:54
88Don Jamesjohn@example.com2025-01-03 21:42:32
89Tom Cattc@example.com2025-01-03 21:43:14
90Woody Woodpeckerwoody@example.com2025-01-03 21:43:14
91Mighty Mousemighty@example.com2025-01-03 21:43:14
92Donald Duckdduckn@example.com2025-01-03 21:52:13
93Daisy Duckdaisyduck@example.com2025-01-03 21:52:13
94Julie Dooleyjuliedooley@example.com2025-01-03 21:52:13
95Bob Marleybobmarley@example.com2025-01-03 21:53:41
96Rita Marleyritamarley@example.com2025-01-03 21:53:41
97Peter Toshpetertosh@example.com2025-01-03 21:53:41
98Tom Cattc@example.com2025-01-03 23:03:10
99Woody Woodpeckerwoody@example.com2025-01-03 23:03:10
100Mighty Mousemighty@example.com2025-01-03 23:03:10
101Don Jamesjohn@example.com2025-01-03 23:15:10
102Bob Marleybobmarley@example.com2025-01-03 23:16:59
103Rita Marleyritamarley@example.com2025-01-03 23:16:59
104Peter Toshpetertosh@example.com2025-01-03 23:16:59
105John Deerjohnd@example.com2025-01-03 23:28:09
106John Deerejohn@deere.net2025-01-03 23:44:09
107Don Jamesjohn@example.com2025-01-03 23:45:27
108Donald Duckdduckn@example.com2025-01-03 23:47:21
109Daisy Duckdaisyduck@example.com2025-01-03 23:47:21
110Julie Dooleyjuliedooley@example.com2025-01-03 23:47:21
111Bob Marleybobmarley@example.com2025-01-04 14:55:02
112Rita Marleyritamarley@example.com2025-01-04 14:55:02
113Peter Toshpetertosh@example.com2025-01-04 14:55:02
114Tom Cattc@example.com2025-01-04 14:57:32
115Woody Woodpeckerwoody@example.com2025-01-04 14:57:32
116Mighty Mousemighty@example.com2025-01-04 14:57:32
117John Deerejohn@deere.net2025-01-04 14:57:34
118Don Jamesjohn@example.com2025-01-04 14:59:50
119Donald Duckdduckn@example.com2025-01-04 15:04:18
120Daisy Duckdaisyduck@example.com2025-01-04 15:04:18
121Julie Dooleyjuliedooley@example.com2025-01-04 15:04:18
122John Deerjohnd@example.com2025-01-04 15:15:14
123Don Jamesjohn@example.com2025-01-04 15:15:18
124Bob Marleybobmarley@example.com2025-01-04 23:35:42
125Rita Marleyritamarley@example.com2025-01-04 23:35:42
126Peter Toshpetertosh@example.com2025-01-04 23:35:42
127Don Jamesjohn@example.com2025-01-04 23:45:51
128Donald Duckdduckn@example.com2025-01-04 23:50:22
129Daisy Duckdaisyduck@example.com2025-01-04 23:50:22
130Julie Dooleyjuliedooley@example.com2025-01-04 23:50:22
131Don Jamesjohn@example.com2025-01-04 23:53:02
132John Deerejohn@deere.net2025-01-04 23:53:09
133Tom Cattc@example.com2025-01-04 23:53:19
134Woody Woodpeckerwoody@example.com2025-01-04 23:53:19
135Mighty Mousemighty@example.com2025-01-04 23:53:19
136John Deerjohnd@example.com2025-01-07 12:53:10
137Don Jamesjohn@example.com2025-01-07 13:08:59
138Bob Marleybobmarley@example.com2025-01-07 13:34:10
139Rita Marleyritamarley@example.com2025-01-07 13:34:10
140Peter Toshpetertosh@example.com2025-01-07 13:34:10
141John Deerejohn@deere.net2025-01-07 13:42:48
142Tom Cattc@example.com2025-01-07 14:13:15
143Woody Woodpeckerwoody@example.com2025-01-07 14:13:15
144Mighty Mousemighty@example.com2025-01-07 14:13:15
145Donald Duckdduckn@example.com2025-01-07 14:21:01
146Daisy Duckdaisyduck@example.com2025-01-07 14:21:01
147Julie Dooleyjuliedooley@example.com2025-01-07 14:21:01
148Don Jamesjohn@example.com2025-01-07 14:22:09
149Don Jamesjohn@example.com2025-01-09 15:10:06
150Bob Marleybobmarley@example.com2025-01-09 15:10:24
151Rita Marleyritamarley@example.com2025-01-09 15:10:24
152Peter Toshpetertosh@example.com2025-01-09 15:10:24
153John Deerjohnd@example.com2025-01-09 15:21:11
154John Deerejohn@deere.net2025-01-09 15:23:48
155Tom Cattc@example.com2025-01-10 07:29:25
156Woody Woodpeckerwoody@example.com2025-01-10 07:29:25
157Mighty Mousemighty@example.com2025-01-10 07:29:25
158Donald Duckdduckn@example.com2025-01-10 07:43:14
159Daisy Duckdaisyduck@example.com2025-01-10 07:43:14
160Julie Dooleyjuliedooley@example.com2025-01-10 07:43:14
161Don Jamesjohn@example.com2025-01-10 08:09:24
162John Deerjohnd@example.com2025-01-12 01:38:22
163John Deerejohn@deere.net2025-01-12 01:39:24
164Don Jamesjohn@example.com2025-01-12 01:49:26
165Bob Marleybobmarley@example.com2025-01-12 01:50:10
166Rita Marleyritamarley@example.com2025-01-12 01:50:10
167Peter Toshpetertosh@example.com2025-01-12 01:50:10
168Tom Cattc@example.com2025-01-12 11:23:59
169Woody Woodpeckerwoody@example.com2025-01-12 11:23:59
170Mighty Mousemighty@example.com2025-01-12 11:23:59
171Don Jamesjohn@example.com2025-01-12 11:28:26
172Donald Duckdduckn@example.com2025-01-12 11:45:57
173Daisy Duckdaisyduck@example.com2025-01-12 11:45:57
174Julie Dooleyjuliedooley@example.com2025-01-12 11:45:57
175Tom Cattc@example.com2025-01-15 14:30:12
176Woody Woodpeckerwoody@example.com2025-01-15 14:30:12
177Mighty Mousemighty@example.com2025-01-15 14:30:12
178John Deerjohnd@example.com2025-01-15 14:36:01
179John Deerejohn@deere.net2025-01-15 14:37:21
180Donald Duckdduckn@example.com2025-01-15 14:42:22
181Daisy Duckdaisyduck@example.com2025-01-15 14:42:22
182Julie Dooleyjuliedooley@example.com2025-01-15 14:42:22
183Don Jamesjohn@example.com2025-01-15 17:46:24
184Bob Marleybobmarley@example.com2025-01-15 17:47:23
185Rita Marleyritamarley@example.com2025-01-15 17:47:23
186Peter Toshpetertosh@example.com2025-01-15 17:47:23
187Don Jamesjohn@example.com2025-01-15 18:11:17
188Donald Duckdduckn@example.com2025-01-18 04:58:55
189Daisy Duckdaisyduck@example.com2025-01-18 04:58:55
190Julie Dooleyjuliedooley@example.com2025-01-18 04:58:55
191Don Jamesjohn@example.com2025-01-18 05:00:56
192Tom Cattc@example.com2025-01-18 05:04:39
193Woody Woodpeckerwoody@example.com2025-01-18 05:04:39
194Mighty Mousemighty@example.com2025-01-18 05:04:39
195John Deerejohn@deere.net2025-01-18 05:09:13
196Bob Marleybobmarley@example.com2025-01-18 05:10:09
197Rita Marleyritamarley@example.com2025-01-18 05:10:09
198Peter Toshpetertosh@example.com2025-01-18 05:10:09
199Don Jamesjohn@example.com2025-01-18 05:13:07
200John Deerjohnd@example.com2025-01-18 05:14:39
201Tom Cattc@example.com2025-01-19 02:48:57
202Woody Woodpeckerwoody@example.com2025-01-19 02:48:57
203Mighty Mousemighty@example.com2025-01-19 02:48:57
204Tom Cattc@example.com2025-01-21 14:48:47
205Woody Woodpeckerwoody@example.com2025-01-21 14:48:47
206Mighty Mousemighty@example.com2025-01-21 14:48:47
207John Deerjohnd@example.com2025-01-21 14:49:17
208John Deerejohn@deere.net2025-01-21 14:49:24
209Donald Duckdduckn@example.com2025-01-21 14:49:26
210Daisy Duckdaisyduck@example.com2025-01-21 14:49:26
211Julie Dooleyjuliedooley@example.com2025-01-21 14:49:26
212Don Jamesjohn@example.com2025-01-21 14:50:45
213Bob Marleybobmarley@example.com2025-01-21 14:51:01
214Rita Marleyritamarley@example.com2025-01-21 14:51:01
215Peter Toshpetertosh@example.com2025-01-21 14:51:01
216Don Jamesjohn@example.com2025-01-21 14:52:54
217John Deerjohnd@example.com2025-01-25 18:40:04
218Tom Cattc@example.com2025-01-29 15:00:24
219Woody Woodpeckerwoody@example.com2025-01-29 15:00:24
220Mighty Mousemighty@example.com2025-01-29 15:00:24
221John Deerjohnd@example.com2025-01-29 15:00:27
222John Deerejohn@deere.net2025-01-29 15:00:31
223Donald Duckdduckn@example.com2025-01-29 15:00:31
224Daisy Duckdaisyduck@example.com2025-01-29 15:00:31
225Julie Dooleyjuliedooley@example.com2025-01-29 15:00:31
226Don Jamesjohn@example.com2025-01-29 15:00:40
227Bob Marleybobmarley@example.com2025-01-29 15:00:41
228Rita Marleyritamarley@example.com2025-01-29 15:00:41
229Peter Toshpetertosh@example.com2025-01-29 15:00:41
230Don Jamesjohn@example.com2025-01-29 15:00:44
231Bob Marleybobmarley@example.com2025-02-01 20:49:42
232Rita Marleyritamarley@example.com2025-02-01 20:49:42
233Peter Toshpetertosh@example.com2025-02-01 20:49:42
234John Deerejohn@deere.net2025-02-01 23:52:10
235Tom Cattc@example.com2025-02-01 23:53:51
236Woody Woodpeckerwoody@example.com2025-02-01 23:53:51
237Mighty Mousemighty@example.com2025-02-01 23:53:51
238Don Jamesjohn@example.com2025-02-02 00:10:16
239John Deerjohnd@example.com2025-02-02 00:38:39
240Donald Duckdduckn@example.com2025-02-02 00:51:21
241Daisy Duckdaisyduck@example.com2025-02-02 00:51:21
242Julie Dooleyjuliedooley@example.com2025-02-02 00:51:21
243Don Jamesjohn@example.com2025-02-02 00:58:12
244Bob Marleybobmarley@example.com2025-02-03 16:37:41
245Rita Marleyritamarley@example.com2025-02-03 16:37:41
246Peter Toshpetertosh@example.com2025-02-03 16:37:41
247Tom Cattc@example.com2025-02-03 16:40:43
248Woody Woodpeckerwoody@example.com2025-02-03 16:40:43
249Mighty Mousemighty@example.com2025-02-03 16:40:43
250John Deerejohn@deere.net2025-02-03 16:40:47
251Don Jamesjohn@example.com2025-02-03 16:43:03
252Donald Duckdduckn@example.com2025-02-03 16:47:31
253Daisy Duckdaisyduck@example.com2025-02-03 16:47:31
254Julie Dooleyjuliedooley@example.com2025-02-03 16:47:31
255John Deerjohnd@example.com2025-02-03 16:59:00
256Don Jamesjohn@example.com2025-02-03 16:59:05
257Donald Duckdduckn@example.com2025-02-04 14:13:42
258Daisy Duckdaisyduck@example.com2025-02-04 14:13:42
259Julie Dooleyjuliedooley@example.com2025-02-04 14:13:42
260Bob Marleybobmarley@example.com2025-02-07 12:52:03
261Rita Marleyritamarley@example.com2025-02-07 12:52:03
262Peter Toshpetertosh@example.com2025-02-07 12:52:03
263John Deerejohn@deere.net2025-02-07 13:08:20
264Tom Cattc@example.com2025-02-07 13:08:28
265Woody Woodpeckerwoody@example.com2025-02-07 13:08:28
266Mighty Mousemighty@example.com2025-02-07 13:08:28
267Don Jamesjohn@example.com2025-02-07 13:10:13
268John Deerjohnd@example.com2025-02-07 13:13:04
269Donald Duckdduckn@example.com2025-02-07 13:13:58
270Daisy Duckdaisyduck@example.com2025-02-07 13:13:58
271Julie Dooleyjuliedooley@example.com2025-02-07 13:13:58
272Don Jamesjohn@example.com2025-02-07 13:14:30
273Bob Marleybobmarley@example.com2025-02-12 06:29:06
274Rita Marleyritamarley@example.com2025-02-12 06:29:06
275Peter Toshpetertosh@example.com2025-02-12 06:29:06
276John Deerejohn@deere.net2025-02-12 06:31:25
277Tom Cattc@example.com2025-02-12 06:31:37
278Woody Woodpeckerwoody@example.com2025-02-12 06:31:37
279Mighty Mousemighty@example.com2025-02-12 06:31:37
280Don Jamesjohn@example.com2025-02-12 06:32:21
281John Deerjohnd@example.com2025-02-12 06:33:08
282Donald Duckdduckn@example.com2025-02-12 06:33:54
283Daisy Duckdaisyduck@example.com2025-02-12 06:33:54
284Julie Dooleyjuliedooley@example.com2025-02-12 06:33:54
285Don Jamesjohn@example.com2025-02-12 06:34:27
286Tom Cattc@example.com2025-02-21 00:23:52
287Woody Woodpeckerwoody@example.com2025-02-21 00:23:52
288Mighty Mousemighty@example.com2025-02-21 00:23:52
289Donald Duckdduckn@example.com2025-02-21 13:04:45
290Daisy Duckdaisyduck@example.com2025-02-21 13:04:45
291Julie Dooleyjuliedooley@example.com2025-02-21 13:04:45
292Tom Cattc@example.com2025-02-21 13:10:18
293Woody Woodpeckerwoody@example.com2025-02-21 13:10:18
294Mighty Mousemighty@example.com2025-02-21 13:10:18
295Don Jamesjohn@example.com2025-02-21 13:14:05
296Don Jamesjohn@example.com2025-02-21 13:16:20
297Bob Marleybobmarley@example.com2025-02-21 13:22:52
298Rita Marleyritamarley@example.com2025-02-21 13:22:52
299Peter Toshpetertosh@example.com2025-02-21 13:22:52
300John Deerejohn@deere.net2025-02-21 13:24:34
301John Deerjohnd@example.com2025-02-23 01:24:24
302Bob Marleybobmarley@example.com2025-02-23 01:39:24
303Rita Marleyritamarley@example.com2025-02-23 01:39:24
304Peter Toshpetertosh@example.com2025-02-23 01:39:24
305John Deerejohn@deere.net2025-02-23 02:04:24
306Tom Cattc@example.com2025-02-23 02:19:24
307Woody Woodpeckerwoody@example.com2025-02-23 02:19:24
308Mighty Mousemighty@example.com2025-02-23 02:19:24
309Donald Duckdduckn@example.com2025-02-23 02:24:24
310Daisy Duckdaisyduck@example.com2025-02-23 02:24:24
311Julie Dooleyjuliedooley@example.com2025-02-23 02:24:24
312Don Jamesjohn@example.com2025-02-23 03:26:13
313Don Jamesjohn@example.com2025-02-23 03:48:02
314Tom Cattc@example.com2025-02-23 11:40:25
315Woody Woodpeckerwoody@example.com2025-02-23 11:40:25
316Mighty Mousemighty@example.com2025-02-23 11:40:25
317Donald Duckdduckn@example.com2025-02-23 21:57:22
318Daisy Duckdaisyduck@example.com2025-02-23 21:57:22
319Julie Dooleyjuliedooley@example.com2025-02-23 21:57:22
320Bob Marleybobmarley@example.com2025-02-24 02:23:02
321Rita Marleyritamarley@example.com2025-02-24 02:23:02
322Peter Toshpetertosh@example.com2025-02-24 02:23:02
323John Deerejohn@deere.net2025-02-24 03:51:14
324Tom Cattc@example.com2025-02-24 03:52:27
325Woody Woodpeckerwoody@example.com2025-02-24 03:52:27
326Mighty Mousemighty@example.com2025-02-24 03:52:27
327Don Jamesjohn@example.com2025-02-24 04:09:35
328John Deerjohnd@example.com2025-02-24 11:10:11
329Donald Duckdduckn@example.com2025-02-24 11:18:39
330Daisy Duckdaisyduck@example.com2025-02-24 11:18:39
331Julie Dooleyjuliedooley@example.com2025-02-24 11:18:39
332Don Jamesjohn@example.com2025-02-24 11:31:47
333Bob Marleybobmarley@example.com2025-02-26 10:07:09
334Rita Marleyritamarley@example.com2025-02-26 10:07:09
335Peter Toshpetertosh@example.com2025-02-26 10:07:09
336Don Jamesjohn@example.com2025-02-27 21:06:25
337Bob Marleybobmarley@example.com2025-02-28 07:32:22
338Rita Marleyritamarley@example.com2025-02-28 07:32:22
339Peter Toshpetertosh@example.com2025-02-28 07:32:22
340Don Jamesjohn@example.com2025-02-28 23:51:06
341Bob Marleybobmarley@example.com2025-03-03 04:35:34
342Rita Marleyritamarley@example.com2025-03-03 04:35:34
343Peter Toshpetertosh@example.com2025-03-03 04:35:34
344John Deerjohnd@example.com2025-03-04 06:42:36
345Don Jamesjohn@example.com2025-03-04 13:25:25
346Don Jamesjohn@example.com2025-03-08 08:08:39
347Bob Marleybobmarley@example.com2025-03-08 13:54:37
348Rita Marleyritamarley@example.com2025-03-08 13:54:37
349Peter Toshpetertosh@example.com2025-03-08 13:54:37
350John Deerejohn@deere.net2025-03-08 13:55:41
351Tom Cattc@example.com2025-03-08 13:55:45
352Woody Woodpeckerwoody@example.com2025-03-08 13:55:45
353Mighty Mousemighty@example.com2025-03-08 13:55:45
354Don Jamesjohn@example.com2025-03-08 13:57:49
355Donald Duckdduckn@example.com2025-03-08 14:02:33
356Daisy Duckdaisyduck@example.com2025-03-08 14:02:33
357Julie Dooleyjuliedooley@example.com2025-03-08 14:02:33
358John Deerjohnd@example.com2025-03-08 14:12:53
359Don Jamesjohn@example.com2025-03-08 14:12:57
360Tom Cattc@example.com2025-03-12 07:10:29
361Woody Woodpeckerwoody@example.com2025-03-12 07:10:29
362Mighty Mousemighty@example.com2025-03-12 07:10:29
363Donald Duckdduckn@example.com2025-03-13 21:14:09
364Daisy Duckdaisyduck@example.com2025-03-13 21:14:09
365Julie Dooleyjuliedooley@example.com2025-03-13 21:14:09
366Bob Marleybobmarley@example.com2025-03-14 13:40:46
367Rita Marleyritamarley@example.com2025-03-14 13:40:46
368Peter Toshpetertosh@example.com2025-03-14 13:40:46
369Tom Cattc@example.com2025-03-16 23:21:54
370Woody Woodpeckerwoody@example.com2025-03-16 23:21:54
371Mighty Mousemighty@example.com2025-03-16 23:21:54
372Bob Marleybobmarley@example.com2025-03-17 23:57:10
373Rita Marleyritamarley@example.com2025-03-17 23:57:10
374Peter Toshpetertosh@example.com2025-03-17 23:57:10
375Tom Cattc@example.com2025-03-18 00:14:11
376Woody Woodpeckerwoody@example.com2025-03-18 00:14:11
377Mighty Mousemighty@example.com2025-03-18 00:14:11
378Don Jamesjohn@example.com2025-03-18 00:15:45
379Donald Duckdduckn@example.com2025-03-18 00:19:37
380Daisy Duckdaisyduck@example.com2025-03-18 00:19:37
381Julie Dooleyjuliedooley@example.com2025-03-18 00:19:37
382Don Jamesjohn@example.com2025-03-18 00:20:05
383Bob Marleybobmarley@example.com2025-03-18 05:52:13
384Rita Marleyritamarley@example.com2025-03-18 05:52:13
385Peter Toshpetertosh@example.com2025-03-18 05:52:13
386Tom Cattc@example.com2025-03-20 01:47:24
387Woody Woodpeckerwoody@example.com2025-03-20 01:47:24
388Mighty Mousemighty@example.com2025-03-20 01:47:24
389Bob Marleybobmarley@example.com2025-03-20 01:47:25
390Rita Marleyritamarley@example.com2025-03-20 01:47:25
391Peter Toshpetertosh@example.com2025-03-20 01:47:25
392Donald Duckdduckn@example.com2025-03-20 01:47:25
393Daisy Duckdaisyduck@example.com2025-03-20 01:47:25
394Julie Dooleyjuliedooley@example.com2025-03-20 01:47:25
395John Deerejohn@deere.net2025-03-20 01:47:25
396John Deerjohnd@example.com2025-03-20 01:47:25
397Don Jamesjohn@example.com2025-03-20 01:47:25
398Don Jamesjohn@example.com2025-03-20 01:47:25
399John Deerejohn@deere.net2025-03-21 10:04:37
400Don Jamesjohn@example.com2025-03-21 20:00:56
401Donald Duckdduckn@example.com2025-03-28 15:49:34
402Daisy Duckdaisyduck@example.com2025-03-28 15:49:34
403Julie Dooleyjuliedooley@example.com2025-03-28 15:49:34
404John Deerjohnd@example.com2025-03-31 19:41:05
405Don Jamesjohn@example.com2025-04-01 03:58:44
406John Deerjohnd@example.com2025-04-02 21:41:35
407John Deerejohn@deere.net2025-04-02 21:46:42
408Don Jamesjohn@example.com2025-04-02 21:49:13
409Don Jamesjohn@example.com2025-04-02 21:53:11
410Tom Cattc@example.com2025-04-02 21:54:36
411Woody Woodpeckerwoody@example.com2025-04-02 21:54:36
412Mighty Mousemighty@example.com2025-04-02 21:54:36
413Donald Duckdduckn@example.com2025-04-02 21:59:41
414Daisy Duckdaisyduck@example.com2025-04-02 21:59:41
415Julie Dooleyjuliedooley@example.com2025-04-02 21:59:41
416John Deerjohnd@example.com2025-04-03 03:38:34
417Don Jamesjohn@example.com2025-04-03 03:39:33
418Donald Duckdduckn@example.com2025-04-03 03:52:32
419Daisy Duckdaisyduck@example.com2025-04-03 03:52:32
420Julie Dooleyjuliedooley@example.com2025-04-03 03:52:32

Here is the code for accessing the database and display the information in a table.

<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "DBname";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}

$sql = "SELECT id, firstname, lastname, email FROM MyGuests";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
  echo "<table><tr><th>ID</th><th>Name</th><th>Email</th><Registration Date</th></tr>";
  // output data of each row
  while($row = $result->fetch_assoc()) {
    echo "<tr style='background-color:yellow';>
<td>".$row["id"]."</td><td>".$row["firstname"]." ".$row["lastname"]."</td>".$row["email"]."</td><td>".$row["reg_date"]."</td></tr>";
  }
  echo "</table>";
} else {
  echo "<p>0 results</p>";
}
$conn->close();
?>