userTable
is an extended version of the table
object. It contains all the same functionality as table
but adds a few more functions to specifically deal with a “user” table in the database.
Parent Class
table
Public Methods
Obviously, all of the table
methods are available as well. They are documented in the table
documentation. In addition to those methods, the following have been added in this class.
Parameters:
$email
(string: required) is the email address to locate the record by. It is assumed your database indeed has a field called ’email’Returns:
True if the record is located, otherwise false.
Example:
1 2 3 4 5 |
$myUserTable = new \ipinga\userTable('users'); $myUserTable->loadByEmail('someone@example.com'); echo $myUserTable->first_name; // outputs the first name for the user who has the email address 'someone@example.com' |
Parameters:
$email
(string: required) is the email address to locate the record by. It is assumed your database indeed has a field called ’email’Returns:
True if the email address is already in use, otherwise false.
Example:
1 2 3 4 5 6 7 |
$myUserTable = new \ipinga\userTable('users'); if ( $myUserTable->isDupeEmail('someone@example.com') ) { echo 'that record already exists'; } else { echo 'email address is not a duplicate of any record currently in the user table'; } |
Parameters:
$username
(string: required) is the username to locate the record by. It is assumed your database indeed has a field called ‘username’Returns:
True if the record is located, otherwise false.
Example:
1 2 3 4 5 |
$myUserTable = new \ipinga\userTable('users'); $myUserTable->loadByUsername('ansonjones1846'); echo $myUserTable->first_name; // outputs the first name for the user who has the username 'ansonjones1846' |
Parameters:
$username
(string: required) is the username to locate the record by. It is assumed your database indeed has a field called ‘username’Returns:
True if the username is already in use, otherwise false.
Example:
1 2 3 4 5 6 7 |
$myUserTable = new \ipinga\userTable('users'); if ( $myUserTable->isDupeUsername('ansonjones1846') ) { echo 'that record already exists'; } else { echo 'username is not a duplicate of any record currently in the user table'; } |