login to a database (from a webpage), inserting data into a database from a form, getting data from...

13
Login to a Database (from a Webpage), Inserting data into a database from a form, getting data from database and display on Webpage Done by: Mashail Alsolamy

Upload: franklin-day

Post on 04-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Login to a Database (from a Webpage), Inserting data into a database from a form, getting data from database and display on Webpage Done by: Mashail Alsolamy

Login to a Database (from a Webpage), Inserting data into a

database from a form, getting data from database and display on

Webpage

Done by: Mashail Alsolamy

Page 2: Login to a Database (from a Webpage), Inserting data into a database from a form, getting data from database and display on Webpage Done by: Mashail Alsolamy

Tools:

• Notepad++• Internet Explorer• WampServer

Page 3: Login to a Database (from a Webpage), Inserting data into a database from a form, getting data from database and display on Webpage Done by: Mashail Alsolamy

Outlines:

• Connecting to Database (Login to Database)

• Insert data into database from a form• getting data from database and display

on Webpage

Page 4: Login to a Database (from a Webpage), Inserting data into a database from a form, getting data from database and display on Webpage Done by: Mashail Alsolamy

Why do we choose MySQL Database?

MySQL is currently the most popular open source database server in existence. It is very commonly used in conjunction with PHP scripts to create powerful and dynamic server-side applications.

Page 5: Login to a Database (from a Webpage), Inserting data into a database from a form, getting data from database and display on Webpage Done by: Mashail Alsolamy

MySQL phpMyAdmin:

It is a popular web interface that is included with almost every type of Shared, Virtual or Dedicated hosting solution and the very popular phpMyAdmin tool should come with your web hosting plan.

Page 6: Login to a Database (from a Webpage), Inserting data into a database from a form, getting data from database and display on Webpage Done by: Mashail Alsolamy
Page 7: Login to a Database (from a Webpage), Inserting data into a database from a form, getting data from database and display on Webpage Done by: Mashail Alsolamy

How do we open phpMyAdmin and create databases and tables: 1. Open your cPanel.

2. Click on phpMyAdmin in the section of database.

3. Create a new database4. Create a new user with password5. Assign the user to the database

6. Create table inside this database.

Server : localhost Database : testTable : example Username : adminPassword : 1admin

Example

Page 8: Login to a Database (from a Webpage), Inserting data into a database from a form, getting data from database and display on Webpage Done by: Mashail Alsolamy

Login to Mysql Database from webpage:

1. Create login form to access the database through it.

2. Verify the username and password

Page 9: Login to a Database (from a Webpage), Inserting data into a database from a form, getting data from database and display on Webpage Done by: Mashail Alsolamy

3. If username and pass word correct then use bellow command to connect to certain database.

// Make a MySQL Connectionmysql_connect( host, username, password) or die

(mysql_error());

mysql_select_db( Name of database) or die (mysql_error());

The default values in wampserver are:Host=“localhost”Username=“root”Password=“”

Page 10: Login to a Database (from a Webpage), Inserting data into a database from a form, getting data from database and display on Webpage Done by: Mashail Alsolamy

4. After connect, we can insert data to the table through the form.

Page 11: Login to a Database (from a Webpage), Inserting data into a database from a form, getting data from database and display on Webpage Done by: Mashail Alsolamy

4. To display The contents of the table onto a webpage use this command:

Page 12: Login to a Database (from a Webpage), Inserting data into a database from a form, getting data from database and display on Webpage Done by: Mashail Alsolamy

4. To delete a record from the table use this command:

Page 13: Login to a Database (from a Webpage), Inserting data into a database from a form, getting data from database and display on Webpage Done by: Mashail Alsolamy

Thank you for your attention

and I hope I explained the

subject well