Simple Login in php my sql.

Learn to create a simple login system with php + mysql script, this tutorial is easy to follow, teach you step by step.

In this tutorial, we create 3 php files for testing our code.
1. index.php (loginform)
2. config.php(mysql connectivity)
3. home.php(after login page redirects)

4. logout.php

STEP1: Create Database named “ravindra” and make a new table named login

CREATE TABLE `login` (
`id` int(4) NOT NULL auto_increment,
`email_id` varchar(65) NOT NULL default ”,
`password` varchar(65) NOT NULL default ”,

— Dumping data for table `members`

INSERT INTO `members` VALUES (1, ‘choudhary’, ‘admin’);

STEP2: Create file config.php for database Connectivity


mysql_connect($hostname, $user, $password) or die(mysql_error());
mysql_select_db(“ravindra”) or die (mysql_error());


you can change hostname, user and password according your system

STEP3: Create file index.php having login form

include ‘config.php’;

View original post 106 more words


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s