SlideShare a Scribd company logo
CN5109
WEB APPLICATION
DEVELOPMENT
Chapter 6
Database: MySQLi and PHPMyAdmin
Database
• A database is a separate application that stores a collection of
data.
• Each database has one or more distinct APIs for creating,
accessing, managing, searching and replicating the data it
holds.
• Other kinds of data stores can be used, such as files on the file
system or large hash tables in memory but data fetching and
writing would not be so fast and easy with those types of
systems.
Database Terminologies
• Database − A database is a collection of tables, with related
data.
• Table − A table is a matrix with data. A table in a database
looks like a simple spreadsheet.
• Column − One column (data element) contains data of one
and the same kind, for example the column postcode.
• Row − A row (= tuple, entry or record) is a group of related
data, for example the data of one subscription.
• Redundancy − Storing data twice, redundantly to make the
system faster.
• Primary Key − A primary key is unique. A key value can not
occur twice in one table. With a key, you can find at most one
row.
MySQLi
• MySQLi is a Relational SQL database management system.
• MySQLi is used inside the PHP programming language to give
an interface with MySQL databases.
MySQLi Database
• MySQLi is released under an open-source license.
• MySQLi is a very powerful program in its own right. It handles a large
subset of the functionality of the most expensive and powerful
database packages.
• MySQLi uses a standard form of the well-known SQL data language.
• MySQLi works on many operating systems and with many languages
including PHP, PERL, C, C++, JAVA, etc.
• MySQLi works very quickly and works well even with large data sets.
• MySQLi is very friendly to PHP, the most appreciated language for
web development.
• MySQLi supports large databases, up to 50 million rows or more in a
table. The default file size limit for a table is 4GB, but you can
increase this (if your operating system can handle it) to a theoretical
limit of 8 million terabytes (TB).
PHPMyAdmin
• phpMyAdmin is a free software tool written in PHP, intended
to handle the administration of MySQL over the Web.
• phpMyAdmin supports a wide range of operations on MySQL
and MariaDB.
• Frequently used operations (managing databases, tables,
columns, relations, indexes, users, permissions, etc) can be
performed via the user interface, while you still have the
ability to directly execute any SQL statement.
PHPMyAdmin cPanel
• On the right side of the screen, in the Database server section you
can find information about the MySQL server.
• The databases which you will manage are stored on the same server
as the software and the hostname is - localhost.
• In the middle part of the page, in the General Settings section, you
can see the MySQL charset and you will be able to define the MySQL
connection collation (utf8_general_ci is the most common utf8
collation).
PHPMyAdmin cPanel
• In the Databases tab you will find a list with all the databases
which can be managed through the cPanel user.
PHPMyAdmin cPanel
• Using SQL tab you can perform a MySQL query towards the
MySQL server. Just type in the query and click the Go button
and the phpMyAdmin tool will execute the query and provide
the results from it.
PHPMyAdmin Creating Database
• Click the Databases tab and then select a database to manage
by clicking its name.
• In the page that opens you will see a list with the database
tables, the allowed actions with them, the number of the
records, the storage engine, the collation, the tables' sizes and
the overhead
PHPMyAdmin Creating Database
Browse
• Only the tables with existing records can be browsed. Once
you click on the Browse button a new page with a list of the
records inside the table will be opened.
• By clicking on the Edit button you can edit the chosen record.
• You will see the record structure and you can alter the values
of the records. Once you are done with the changes, you can
submit them bu clicking the Go button at the bottom of the
page.
PHPMyAdmin Creating Database
Structure
• By clicking the Structure button a new page will open that
shows the database table's structure.
• You will see the fields' names, their types, collations,
attributes, additional extra information, the default values and
whether the fields' values can be NULL.
PHPMyAdmin Creating Database
Insert
• Using the Insert button you can insert records in your
database table.
• Once you fill in the corresponding values click on the Go
button and the new record will be inserted.
PHPMyAdmin Creating Database
Drop
• With the Drop button you can delete the whole table and all
the records stored in it.
PHPMyAdmin Creating Table
• To create new tables inside a database, first open the
phpMyAdmin tool, click on the Databases tab and click on the
name of the desired database. On the new page that opens
you will see a list of all the current tables inside the database
and a section named Create table.
• In that section, in the Name field you should input the desired
new name of the table and then select the number of columns
that the table should have via the Number of columns drop-
down.
• When ready, click the Go button to create the table.
PHPMyAdmin Creating Table
• Name - The name of the column;
• Type - The type of the data, which will be stored in the
corresponding column. More details about the possible
choices can be found in the official MySQL Data Types
documentation;
• Length/Values - The length of the field;
Default - With this option you can specify if the fields in the
column would have a default value. This is useful for example
if you want to have timestamps for the entries in each row;
Collation - The data collation for each of the fields;
• Attributes - assign any special attributes to the fields;
PHPMyAdmin Creating Table
• Null - Define whether the field value can be NULL. More about
the NULL value can be found in the MySQL documentation;
• Index - Set the Index of the row. More information about the
MySQL column indexes can be found in the MySQL
documentation;
• A_I - Short for Auto Increment. If this option is enabled then
the values in the fields of the column will be auto
incremented;
• Comments - Here you can add comments, which will be
included in the database SQL code.
PHPMyAdmin Creating Table
To create a table:
• Select the database.
• Enter a Name for the new table.
• Enter the number of fields this new table is to have. Click Go.
• Enter the details of each field within the new table.
• Field Name, Data Type, etc…
PHPMyAdmin Data Types
• Properly defining the fields in a table is important to the
overall optimization of your database.
• You should use only the type and size of field you really need
to use.
• These types of fields (or columns) are also referred to as data
types, after the type of data you will be storing in those fields.
PHPMyAdmin Data Types
Numeric Data
Data Type Description
INT A normal-sized integer that can be
signed or unsigned. If signed, the
allowable range is from -2147483648 to
2147483647. If unsigned, the allowable
range is from 0 to 4294967295. You can
specify a width of up to 11 digits.
FLOAT(M,D) A floating-point number that cannot be
unsigned. You can define the display
length (M) and the number of decimals
(D).
PHPMyAdmin Data Types
Date and Time
Data Type Description
DATE A date in YYYY-MM-DD format, between
1000-01-01 and 9999-12-31.
TIME Stores the time in HH:MM:SS format.
YEAR(M) Stores a year in 2-digit or 4-digit format.
If the length is specified as 2 (for
example YEAR(2)), YEAR can be 1970 to
2069 (70 to 69).
PHPMyAdmin Data Types
String
Data Type Description
VARCHAR(M) A variable-length string between 1 and
255 characters in length; for example
VARCHAR(25). You must define a length
when creating a VARCHAR field.
CHAR(M) A fixed-length string between 1 and 255
characters in length (for example
CHAR(5)), right-padded with spaces to
the specified length when stored.
Defining a length is not required, but
the default is 1.
Lab Practical
1. Create a Database called “FTMS”
2. Create a Table called “student” with the following attributes:
Field Name Data Type
studentid int
studentname varchar
studentprogramme varchar
programmemode varchar
dateregister date
fee int

More Related Content

What's hot

Indexing structure for files
Indexing structure for filesIndexing structure for files
Indexing structure for files
Zainab Almugbel
 
Oceangraphic data formats
Oceangraphic data formatsOceangraphic data formats
Oceangraphic data formats
Fiddy Prasetiya
 
Lecture12 abap on line
Lecture12 abap on lineLecture12 abap on line
Lecture12 abap on line
Milind Patil
 
File organization 1
File organization 1File organization 1
File organization 1
Rupali Rana
 
Database Fundamentals
Database FundamentalsDatabase Fundamentals
Database Fundamentals
lindy23
 
Ijebea14 228
Ijebea14 228Ijebea14 228
Ijebea14 228
Iasir Journals
 
Microsoft Access
Microsoft AccessMicrosoft Access
Microsoft Access
tormeyj
 
Hardware implementation of page table
Hardware implementation of page table Hardware implementation of page table
Hardware implementation of page table
Sukhraj Singh
 
Structure of the page table
Structure of the page tableStructure of the page table
Structure of the page table
duvvuru madhuri
 
Database indexing techniques
Database indexing techniquesDatabase indexing techniques
Database indexing techniques
ahmadmughal0312
 
MySQL Space Management
MySQL Space ManagementMySQL Space Management
MySQL Space Management
MIJIN AN
 
Databases
DatabasesDatabases
Databases
sunny_sun
 
New in Hadoop: You should know the Various File Format in Hadoop.
New in Hadoop: You should know the Various File Format in Hadoop.New in Hadoop: You should know the Various File Format in Hadoop.
New in Hadoop: You should know the Various File Format in Hadoop.
veeracynixit
 
Postgres db performance improvements
Postgres db performance improvementsPostgres db performance improvements
Postgres db performance improvements
Mahesh Chopker
 
Inverted page tables basic
Inverted page tables basicInverted page tables basic
Inverted page tables basic
Sanoj Kumar
 
Falando de MySQL
Falando de MySQLFalando de MySQL
Falando de MySQL
Márcio Junior
 
Indy pass writing efficient queries – part 1 - indexing
Indy pass   writing efficient queries – part 1 - indexingIndy pass   writing efficient queries – part 1 - indexing
Indy pass writing efficient queries – part 1 - indexing
eddiew
 
B tree
B treeB tree
B tree
Padma Kannan
 
Implementation of page table
Implementation of page tableImplementation of page table
Implementation of page table
guestff64339
 
Intro databases (Table, Record, Field)
Intro databases (Table, Record, Field)Intro databases (Table, Record, Field)
Intro databases (Table, Record, Field)
Maryam Fida
 

What's hot (20)

Indexing structure for files
Indexing structure for filesIndexing structure for files
Indexing structure for files
 
Oceangraphic data formats
Oceangraphic data formatsOceangraphic data formats
Oceangraphic data formats
 
Lecture12 abap on line
Lecture12 abap on lineLecture12 abap on line
Lecture12 abap on line
 
File organization 1
File organization 1File organization 1
File organization 1
 
Database Fundamentals
Database FundamentalsDatabase Fundamentals
Database Fundamentals
 
Ijebea14 228
Ijebea14 228Ijebea14 228
Ijebea14 228
 
Microsoft Access
Microsoft AccessMicrosoft Access
Microsoft Access
 
Hardware implementation of page table
Hardware implementation of page table Hardware implementation of page table
Hardware implementation of page table
 
Structure of the page table
Structure of the page tableStructure of the page table
Structure of the page table
 
Database indexing techniques
Database indexing techniquesDatabase indexing techniques
Database indexing techniques
 
MySQL Space Management
MySQL Space ManagementMySQL Space Management
MySQL Space Management
 
Databases
DatabasesDatabases
Databases
 
New in Hadoop: You should know the Various File Format in Hadoop.
New in Hadoop: You should know the Various File Format in Hadoop.New in Hadoop: You should know the Various File Format in Hadoop.
New in Hadoop: You should know the Various File Format in Hadoop.
 
Postgres db performance improvements
Postgres db performance improvementsPostgres db performance improvements
Postgres db performance improvements
 
Inverted page tables basic
Inverted page tables basicInverted page tables basic
Inverted page tables basic
 
Falando de MySQL
Falando de MySQLFalando de MySQL
Falando de MySQL
 
Indy pass writing efficient queries – part 1 - indexing
Indy pass   writing efficient queries – part 1 - indexingIndy pass   writing efficient queries – part 1 - indexing
Indy pass writing efficient queries – part 1 - indexing
 
B tree
B treeB tree
B tree
 
Implementation of page table
Implementation of page tableImplementation of page table
Implementation of page table
 
Intro databases (Table, Record, Field)
Intro databases (Table, Record, Field)Intro databases (Table, Record, Field)
Intro databases (Table, Record, Field)
 

Similar to Web Application Development using PHP Chapter 6

Ms access
Ms accessMs access
Ms access
RoshanMaharjan13
 
Introduction to ms access database
Introduction to ms access databaseIntroduction to ms access database
Introduction to ms access database
Obuasi Senior High Technical School
 
Presentation DBMS (1)
Presentation DBMS (1)Presentation DBMS (1)
Presentation DBMS (1)
Ali Raza
 
Chapter 4 terminolgy of keyvalue databses from nosql for mere mortals
Chapter 4 terminolgy of keyvalue databses from nosql for mere mortalsChapter 4 terminolgy of keyvalue databses from nosql for mere mortals
Chapter 4 terminolgy of keyvalue databses from nosql for mere mortals
nehabsairam
 
SQL SERVER Training in Pune Slides
SQL SERVER Training in Pune SlidesSQL SERVER Training in Pune Slides
SQL SERVER Training in Pune Slides
enosislearningcom
 
01 Microsoft Access
01 Microsoft Access01 Microsoft Access
Database Management Systems.pptx
Database Management Systems.pptxDatabase Management Systems.pptx
Database Management Systems.pptx
CallplanetsDeveloper
 
MS-ACCESS.pptx
MS-ACCESS.pptxMS-ACCESS.pptx
MS-ACCESS.pptx
shivamdwivedi898297
 
MS Access Intro
MS Access IntroMS Access Intro
MS Access Intro
DannyMondragon
 
People soft basics
People soft basicsPeople soft basics
People soft basics
technicalguru
 
Amazon Redshift: Performance Tuning and Optimization
Amazon Redshift: Performance Tuning and OptimizationAmazon Redshift: Performance Tuning and Optimization
Amazon Redshift: Performance Tuning and Optimization
Amazon Web Services
 
Database an introduction
Database an introductionDatabase an introduction
Database an introduction
Anwarul Islam, PhD
 
MS ACCESS
MS ACCESSMS ACCESS
Lec20.pptx introduction to data bases and information systems
Lec20.pptx introduction to data bases and information systemsLec20.pptx introduction to data bases and information systems
Lec20.pptx introduction to data bases and information systems
samiullahamjad06
 
Implementing the Databese Server session 02
Implementing the Databese Server session 02Implementing the Databese Server session 02
Implementing the Databese Server session 02
Guillermo Julca
 
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
WrushabhShirsat3
 
unit-ii.pptx
unit-ii.pptxunit-ii.pptx
unit-ii.pptx
NilamHonmane
 
MySql
MySqlMySql
Uses of MS Access in Business
Uses of MS Access in BusinessUses of MS Access in Business
Uses of MS Access in Business
Biswajit Bhattacharjee
 
6.2 software
6.2 software6.2 software

Similar to Web Application Development using PHP Chapter 6 (20)

Ms access
Ms accessMs access
Ms access
 
Introduction to ms access database
Introduction to ms access databaseIntroduction to ms access database
Introduction to ms access database
 
Presentation DBMS (1)
Presentation DBMS (1)Presentation DBMS (1)
Presentation DBMS (1)
 
Chapter 4 terminolgy of keyvalue databses from nosql for mere mortals
Chapter 4 terminolgy of keyvalue databses from nosql for mere mortalsChapter 4 terminolgy of keyvalue databses from nosql for mere mortals
Chapter 4 terminolgy of keyvalue databses from nosql for mere mortals
 
SQL SERVER Training in Pune Slides
SQL SERVER Training in Pune SlidesSQL SERVER Training in Pune Slides
SQL SERVER Training in Pune Slides
 
01 Microsoft Access
01 Microsoft Access01 Microsoft Access
01 Microsoft Access
 
Database Management Systems.pptx
Database Management Systems.pptxDatabase Management Systems.pptx
Database Management Systems.pptx
 
MS-ACCESS.pptx
MS-ACCESS.pptxMS-ACCESS.pptx
MS-ACCESS.pptx
 
MS Access Intro
MS Access IntroMS Access Intro
MS Access Intro
 
People soft basics
People soft basicsPeople soft basics
People soft basics
 
Amazon Redshift: Performance Tuning and Optimization
Amazon Redshift: Performance Tuning and OptimizationAmazon Redshift: Performance Tuning and Optimization
Amazon Redshift: Performance Tuning and Optimization
 
Database an introduction
Database an introductionDatabase an introduction
Database an introduction
 
MS ACCESS
MS ACCESSMS ACCESS
MS ACCESS
 
Lec20.pptx introduction to data bases and information systems
Lec20.pptx introduction to data bases and information systemsLec20.pptx introduction to data bases and information systems
Lec20.pptx introduction to data bases and information systems
 
Implementing the Databese Server session 02
Implementing the Databese Server session 02Implementing the Databese Server session 02
Implementing the Databese Server session 02
 
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
 
unit-ii.pptx
unit-ii.pptxunit-ii.pptx
unit-ii.pptx
 
MySql
MySqlMySql
MySql
 
Uses of MS Access in Business
Uses of MS Access in BusinessUses of MS Access in Business
Uses of MS Access in Business
 
6.2 software
6.2 software6.2 software
6.2 software
 

More from Mohd Harris Ahmad Jaal

Fundamentals of Programming Chapter 7
Fundamentals of Programming Chapter 7Fundamentals of Programming Chapter 7
Fundamentals of Programming Chapter 7
Mohd Harris Ahmad Jaal
 
Fundamentals of Programming Chapter 6
Fundamentals of Programming Chapter 6Fundamentals of Programming Chapter 6
Fundamentals of Programming Chapter 6
Mohd Harris Ahmad Jaal
 
Fundamentals of Programming Chapter 4
Fundamentals of Programming Chapter 4Fundamentals of Programming Chapter 4
Fundamentals of Programming Chapter 4
Mohd Harris Ahmad Jaal
 
Fundamentals of Programming Chapter 3
Fundamentals of Programming Chapter 3Fundamentals of Programming Chapter 3
Fundamentals of Programming Chapter 3
Mohd Harris Ahmad Jaal
 
Fundamentals of Programming Chapter 2
Fundamentals of Programming Chapter 2Fundamentals of Programming Chapter 2
Fundamentals of Programming Chapter 2
Mohd Harris Ahmad Jaal
 
Fundamentals of Programming Chapter 1
Fundamentals of Programming Chapter 1Fundamentals of Programming Chapter 1
Fundamentals of Programming Chapter 1
Mohd Harris Ahmad Jaal
 
Fundamentals of Programming Chapter 5
Fundamentals of Programming Chapter 5Fundamentals of Programming Chapter 5
Fundamentals of Programming Chapter 5
Mohd Harris Ahmad Jaal
 
Web Application Development using PHP Chapter 8
Web Application Development using PHP Chapter 8Web Application Development using PHP Chapter 8
Web Application Development using PHP Chapter 8
Mohd Harris Ahmad Jaal
 
Web Application Development using PHP Chapter 7
Web Application Development using PHP Chapter 7Web Application Development using PHP Chapter 7
Web Application Development using PHP Chapter 7
Mohd Harris Ahmad Jaal
 
Web Application Development using PHP Chapter 5
Web Application Development using PHP Chapter 5Web Application Development using PHP Chapter 5
Web Application Development using PHP Chapter 5
Mohd Harris Ahmad Jaal
 
Web Application Development using PHP Chapter 4
Web Application Development using PHP Chapter 4Web Application Development using PHP Chapter 4
Web Application Development using PHP Chapter 4
Mohd Harris Ahmad Jaal
 
Web Application Development using PHP Chapter 3
Web Application Development using PHP Chapter 3Web Application Development using PHP Chapter 3
Web Application Development using PHP Chapter 3
Mohd Harris Ahmad Jaal
 
Web Application Development using PHP Chapter 2
Web Application Development using PHP Chapter 2Web Application Development using PHP Chapter 2
Web Application Development using PHP Chapter 2
Mohd Harris Ahmad Jaal
 
Web Application Development using PHP Chapter 1
Web Application Development using PHP Chapter 1Web Application Development using PHP Chapter 1
Web Application Development using PHP Chapter 1
Mohd Harris Ahmad Jaal
 
Fundamentals of Computing Chapter 10
Fundamentals of Computing Chapter 10Fundamentals of Computing Chapter 10
Fundamentals of Computing Chapter 10
Mohd Harris Ahmad Jaal
 
Fundamentals of Computing Chapter 9
Fundamentals of Computing Chapter 9Fundamentals of Computing Chapter 9
Fundamentals of Computing Chapter 9
Mohd Harris Ahmad Jaal
 
Fundamentals of Computing Chapter 8
Fundamentals of Computing Chapter 8Fundamentals of Computing Chapter 8
Fundamentals of Computing Chapter 8
Mohd Harris Ahmad Jaal
 
Fundamentals of Computing Chapter 7
Fundamentals of Computing Chapter 7Fundamentals of Computing Chapter 7
Fundamentals of Computing Chapter 7
Mohd Harris Ahmad Jaal
 
Fundamentals of Computing Chapter 6
Fundamentals of Computing Chapter 6Fundamentals of Computing Chapter 6
Fundamentals of Computing Chapter 6
Mohd Harris Ahmad Jaal
 
Fundamentals of Computing Chapter 5
Fundamentals of Computing Chapter 5Fundamentals of Computing Chapter 5
Fundamentals of Computing Chapter 5
Mohd Harris Ahmad Jaal
 

More from Mohd Harris Ahmad Jaal (20)

Fundamentals of Programming Chapter 7
Fundamentals of Programming Chapter 7Fundamentals of Programming Chapter 7
Fundamentals of Programming Chapter 7
 
Fundamentals of Programming Chapter 6
Fundamentals of Programming Chapter 6Fundamentals of Programming Chapter 6
Fundamentals of Programming Chapter 6
 
Fundamentals of Programming Chapter 4
Fundamentals of Programming Chapter 4Fundamentals of Programming Chapter 4
Fundamentals of Programming Chapter 4
 
Fundamentals of Programming Chapter 3
Fundamentals of Programming Chapter 3Fundamentals of Programming Chapter 3
Fundamentals of Programming Chapter 3
 
Fundamentals of Programming Chapter 2
Fundamentals of Programming Chapter 2Fundamentals of Programming Chapter 2
Fundamentals of Programming Chapter 2
 
Fundamentals of Programming Chapter 1
Fundamentals of Programming Chapter 1Fundamentals of Programming Chapter 1
Fundamentals of Programming Chapter 1
 
Fundamentals of Programming Chapter 5
Fundamentals of Programming Chapter 5Fundamentals of Programming Chapter 5
Fundamentals of Programming Chapter 5
 
Web Application Development using PHP Chapter 8
Web Application Development using PHP Chapter 8Web Application Development using PHP Chapter 8
Web Application Development using PHP Chapter 8
 
Web Application Development using PHP Chapter 7
Web Application Development using PHP Chapter 7Web Application Development using PHP Chapter 7
Web Application Development using PHP Chapter 7
 
Web Application Development using PHP Chapter 5
Web Application Development using PHP Chapter 5Web Application Development using PHP Chapter 5
Web Application Development using PHP Chapter 5
 
Web Application Development using PHP Chapter 4
Web Application Development using PHP Chapter 4Web Application Development using PHP Chapter 4
Web Application Development using PHP Chapter 4
 
Web Application Development using PHP Chapter 3
Web Application Development using PHP Chapter 3Web Application Development using PHP Chapter 3
Web Application Development using PHP Chapter 3
 
Web Application Development using PHP Chapter 2
Web Application Development using PHP Chapter 2Web Application Development using PHP Chapter 2
Web Application Development using PHP Chapter 2
 
Web Application Development using PHP Chapter 1
Web Application Development using PHP Chapter 1Web Application Development using PHP Chapter 1
Web Application Development using PHP Chapter 1
 
Fundamentals of Computing Chapter 10
Fundamentals of Computing Chapter 10Fundamentals of Computing Chapter 10
Fundamentals of Computing Chapter 10
 
Fundamentals of Computing Chapter 9
Fundamentals of Computing Chapter 9Fundamentals of Computing Chapter 9
Fundamentals of Computing Chapter 9
 
Fundamentals of Computing Chapter 8
Fundamentals of Computing Chapter 8Fundamentals of Computing Chapter 8
Fundamentals of Computing Chapter 8
 
Fundamentals of Computing Chapter 7
Fundamentals of Computing Chapter 7Fundamentals of Computing Chapter 7
Fundamentals of Computing Chapter 7
 
Fundamentals of Computing Chapter 6
Fundamentals of Computing Chapter 6Fundamentals of Computing Chapter 6
Fundamentals of Computing Chapter 6
 
Fundamentals of Computing Chapter 5
Fundamentals of Computing Chapter 5Fundamentals of Computing Chapter 5
Fundamentals of Computing Chapter 5
 

Recently uploaded

PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 

Recently uploaded (20)

PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 

Web Application Development using PHP Chapter 6

  • 2. Database • A database is a separate application that stores a collection of data. • Each database has one or more distinct APIs for creating, accessing, managing, searching and replicating the data it holds. • Other kinds of data stores can be used, such as files on the file system or large hash tables in memory but data fetching and writing would not be so fast and easy with those types of systems.
  • 3. Database Terminologies • Database − A database is a collection of tables, with related data. • Table − A table is a matrix with data. A table in a database looks like a simple spreadsheet. • Column − One column (data element) contains data of one and the same kind, for example the column postcode. • Row − A row (= tuple, entry or record) is a group of related data, for example the data of one subscription. • Redundancy − Storing data twice, redundantly to make the system faster. • Primary Key − A primary key is unique. A key value can not occur twice in one table. With a key, you can find at most one row.
  • 4. MySQLi • MySQLi is a Relational SQL database management system. • MySQLi is used inside the PHP programming language to give an interface with MySQL databases.
  • 5. MySQLi Database • MySQLi is released under an open-source license. • MySQLi is a very powerful program in its own right. It handles a large subset of the functionality of the most expensive and powerful database packages. • MySQLi uses a standard form of the well-known SQL data language. • MySQLi works on many operating systems and with many languages including PHP, PERL, C, C++, JAVA, etc. • MySQLi works very quickly and works well even with large data sets. • MySQLi is very friendly to PHP, the most appreciated language for web development. • MySQLi supports large databases, up to 50 million rows or more in a table. The default file size limit for a table is 4GB, but you can increase this (if your operating system can handle it) to a theoretical limit of 8 million terabytes (TB).
  • 6. PHPMyAdmin • phpMyAdmin is a free software tool written in PHP, intended to handle the administration of MySQL over the Web. • phpMyAdmin supports a wide range of operations on MySQL and MariaDB. • Frequently used operations (managing databases, tables, columns, relations, indexes, users, permissions, etc) can be performed via the user interface, while you still have the ability to directly execute any SQL statement.
  • 7. PHPMyAdmin cPanel • On the right side of the screen, in the Database server section you can find information about the MySQL server. • The databases which you will manage are stored on the same server as the software and the hostname is - localhost. • In the middle part of the page, in the General Settings section, you can see the MySQL charset and you will be able to define the MySQL connection collation (utf8_general_ci is the most common utf8 collation).
  • 8. PHPMyAdmin cPanel • In the Databases tab you will find a list with all the databases which can be managed through the cPanel user.
  • 9. PHPMyAdmin cPanel • Using SQL tab you can perform a MySQL query towards the MySQL server. Just type in the query and click the Go button and the phpMyAdmin tool will execute the query and provide the results from it.
  • 10. PHPMyAdmin Creating Database • Click the Databases tab and then select a database to manage by clicking its name. • In the page that opens you will see a list with the database tables, the allowed actions with them, the number of the records, the storage engine, the collation, the tables' sizes and the overhead
  • 11. PHPMyAdmin Creating Database Browse • Only the tables with existing records can be browsed. Once you click on the Browse button a new page with a list of the records inside the table will be opened. • By clicking on the Edit button you can edit the chosen record. • You will see the record structure and you can alter the values of the records. Once you are done with the changes, you can submit them bu clicking the Go button at the bottom of the page.
  • 12. PHPMyAdmin Creating Database Structure • By clicking the Structure button a new page will open that shows the database table's structure. • You will see the fields' names, their types, collations, attributes, additional extra information, the default values and whether the fields' values can be NULL.
  • 13. PHPMyAdmin Creating Database Insert • Using the Insert button you can insert records in your database table. • Once you fill in the corresponding values click on the Go button and the new record will be inserted.
  • 14. PHPMyAdmin Creating Database Drop • With the Drop button you can delete the whole table and all the records stored in it.
  • 15. PHPMyAdmin Creating Table • To create new tables inside a database, first open the phpMyAdmin tool, click on the Databases tab and click on the name of the desired database. On the new page that opens you will see a list of all the current tables inside the database and a section named Create table. • In that section, in the Name field you should input the desired new name of the table and then select the number of columns that the table should have via the Number of columns drop- down. • When ready, click the Go button to create the table.
  • 16. PHPMyAdmin Creating Table • Name - The name of the column; • Type - The type of the data, which will be stored in the corresponding column. More details about the possible choices can be found in the official MySQL Data Types documentation; • Length/Values - The length of the field; Default - With this option you can specify if the fields in the column would have a default value. This is useful for example if you want to have timestamps for the entries in each row; Collation - The data collation for each of the fields; • Attributes - assign any special attributes to the fields;
  • 17. PHPMyAdmin Creating Table • Null - Define whether the field value can be NULL. More about the NULL value can be found in the MySQL documentation; • Index - Set the Index of the row. More information about the MySQL column indexes can be found in the MySQL documentation; • A_I - Short for Auto Increment. If this option is enabled then the values in the fields of the column will be auto incremented; • Comments - Here you can add comments, which will be included in the database SQL code.
  • 18. PHPMyAdmin Creating Table To create a table: • Select the database. • Enter a Name for the new table. • Enter the number of fields this new table is to have. Click Go. • Enter the details of each field within the new table. • Field Name, Data Type, etc…
  • 19. PHPMyAdmin Data Types • Properly defining the fields in a table is important to the overall optimization of your database. • You should use only the type and size of field you really need to use. • These types of fields (or columns) are also referred to as data types, after the type of data you will be storing in those fields.
  • 20. PHPMyAdmin Data Types Numeric Data Data Type Description INT A normal-sized integer that can be signed or unsigned. If signed, the allowable range is from -2147483648 to 2147483647. If unsigned, the allowable range is from 0 to 4294967295. You can specify a width of up to 11 digits. FLOAT(M,D) A floating-point number that cannot be unsigned. You can define the display length (M) and the number of decimals (D).
  • 21. PHPMyAdmin Data Types Date and Time Data Type Description DATE A date in YYYY-MM-DD format, between 1000-01-01 and 9999-12-31. TIME Stores the time in HH:MM:SS format. YEAR(M) Stores a year in 2-digit or 4-digit format. If the length is specified as 2 (for example YEAR(2)), YEAR can be 1970 to 2069 (70 to 69).
  • 22. PHPMyAdmin Data Types String Data Type Description VARCHAR(M) A variable-length string between 1 and 255 characters in length; for example VARCHAR(25). You must define a length when creating a VARCHAR field. CHAR(M) A fixed-length string between 1 and 255 characters in length (for example CHAR(5)), right-padded with spaces to the specified length when stored. Defining a length is not required, but the default is 1.
  • 23. Lab Practical 1. Create a Database called “FTMS” 2. Create a Table called “student” with the following attributes: Field Name Data Type studentid int studentname varchar studentprogramme varchar programmemode varchar dateregister date fee int