April 2026
Intermediate
1009 pages
34h 15m
English
After all the theory, it's now time to put it into practice: the guestbook is implemented using the mysqli extension. The data is stored in the same database called PHP that was used before.
The first step is to create a database (this has already been done) and a table for the guestbook. The following listing sends a corresponding CREATE TABLE statement to the MySQL extension.
<?php if ($db = mysqli_connect("localhost", "user", "password", "PHP")) { $sql = "CREATE TABLE guestbook ( id INT AUTO_INCREMENT PRIMARY KEY, heading VARCHAR(1000), entry VARCHAR(8000), author VARCHAR(50), email VARCHAR(100), date TIMESTAMP )"; if (mysqli_query($db, $sql)) { echo "Table created.<br />"; } else { echo ...
Read now
Unlock full access