Book Image

Building a Web Application with PHP and MariaDB: A Reference Guide

By : Sai S Sriparasa
Book Image

Building a Web Application with PHP and MariaDB: A Reference Guide

By: Sai S Sriparasa

Overview of this book

Table of Contents (17 chapters)
Building a Web Application with PHP and MariaDB: A Reference Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

User roles


In this section, let's begin by creating administrators who will have access across the student portal and will be able to perform operations such as adding courses and registering any student for a course. Let's begin by creating a few administrators. We will be building an admin table that will store the information for the administrators. The following script will create the admin table and add a couple of administrators. The script is saved as the assets/sql/admin.sql file:

CREATE TABLE IF NOT EXISTS 'admin' (
  'admin_id' int(11) NOT NULL AUTO_INCREMENT,
  'name' varchar(45) NOT NULL,
  'username' varchar(45) NOT NULL,
  'password' varchar(45) NOT NULL,
  PRIMARY KEY ('admin_id')
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

--
-- Dumping data for table 'admin'
--

INSERT INTO 'admin' ('admin_id', 'name', 'username', 'password') VALUES
(1, 'admin1', 'admin1', '5f4dcc3b5aa765d61d8327deb882cf99'),
(2, 'admin2', 'admin2', '5f4dcc3b5aa765d61d8327deb882cf99');

Now...