In this task, we will be creating a new user model, creating a table in MySQL database to save the registration data using TableGateway
to store registration data to the table. We will, finally, connect our registration form to UserTable
so that new registrations are stored in the database. Perform the following steps to do so:
A new table needs to be created to store the registration information in the MySQL database:
CREATE TABLE user ( id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, name TEXT NOT NULL, email VARCHAR(255) NOT NULL, password TEXT NOT NULL, PRIMARY KEY (id), UNIQUE INDEX idx_email(email) );
The application's global configuration needs to be modified to add references to the database connection as shown in the following snippet. This is available under
<Application_Home>/config/autoload/global.php
.return array( 'db' => array( 'driver' => 'Pdo', 'dsn' => 'mysql...