Php/mysqlFrom WikiJava
this tutorial helps will help a developer to create web-based application that reqiures to login and saves users details in a database.
the articlefirst you need to create a database and the reqiured tables i.e database: Accadius&co tables: Staffreg, Casualsreg, Visitorsreg, logins import this schema into your sql browser. copy the following code and save it as system.sql <<--author Accadius Ben Sabwa-->> <<--create database code-->> CREATE DATABASE Accadius&co, <<--create staff registration table code-->> CREATE TABLE Staffreg( staff_id varchar(50) NOT NULL PRIMARY KEY, password varchar(50) NOT NULL, regtime varchar(50) NOT NULL, regdate varchar(50) NOT NULL ); <<--create cassuals registration table code-->> CREATE TABLE Cassualsreg( cassual_id varchar(50) NOT NULL PRIMARY KEY, password varchar(50) NOT NULL, regtime varchar(50) NOT NULL, regdate varchar(50) NOT NULL ); <<--create visitors registration table code-->> CREATE TABLE visitorsreg( visitor_id varchar(50) NOT NULL PRIMARY KEY, password varchar(50) NOT NULL, regtime varchar(50) NOT NULL, regdate varchar(50) NOT NULL ); <<--create logins table that will keep track of anybody who logs into the system-->> CREATE TABLE logins( id varchar(50) NOT NULL PRIMARY KEY, logintime varchar(50) NOT NULL, logindate varchar(50) NOT NULL ); logouttime varchar(50) NOT NULL ); logoutdate varchar(50) NOT NULL ); <<--system.sql ends here-->> after creating all the tables, you need to create the first php file i.e the config.php that allows the database connection to your system copy the following code and paste in a texteditor and save as config.php //--author Accadius ben Sabwa--// //--this defines the local server instaled on your machine e.g apache2.2, wampserver--// define('DB_HOST', 'localhost'); //--this defines the username you have used on your mysql querry browser--// define('DB_USER', 'Your_username'); //--this defines the password you use to access mysql--// define('DB_PASSWORD', 'Your_password'); //--this is the database where the records will be kept--// define('DB_DATABASE', 'accadius&co'); ill be adding the remaining code later, cheerz accadius
|
