SlideShare una empresa de Scribd logo
1 de 23
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

Más contenido relacionado

La actualidad más candente

Indexing structure for files
Indexing structure for filesIndexing structure for files
Indexing structure for filesZainab Almugbel
 
Oceangraphic data formats
Oceangraphic data formatsOceangraphic data formats
Oceangraphic data formatsFiddy Prasetiya
 
Lecture12 abap on line
Lecture12 abap on lineLecture12 abap on line
Lecture12 abap on lineMilind Patil
 
File organization 1
File organization 1File organization 1
File organization 1Rupali Rana
 
Database Fundamentals
Database FundamentalsDatabase Fundamentals
Database Fundamentalslindy23
 
Microsoft Access
Microsoft AccessMicrosoft Access
Microsoft Accesstormeyj
 
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 tableduvvuru madhuri
 
Database indexing techniques
Database indexing techniquesDatabase indexing techniques
Database indexing techniquesahmadmughal0312
 
MySQL Space Management
MySQL Space ManagementMySQL Space Management
MySQL Space ManagementMIJIN AN
 
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 improvementsMahesh Chopker
 
Inverted page tables basic
Inverted page tables basicInverted page tables basic
Inverted page tables basicSanoj Kumar
 
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 - indexingeddiew
 
Implementation of page table
Implementation of page tableImplementation of page table
Implementation of page tableguestff64339
 
Intro databases (Table, Record, Field)
Intro databases (Table, Record, Field)Intro databases (Table, Record, Field)
Intro databases (Table, Record, Field)Maryam Fida
 

La actualidad más candente (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 a Web Application Development using PHP Chapter 6

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 mortalsnehabsairam
 
SQL SERVER Training in Pune Slides
SQL SERVER Training in Pune SlidesSQL SERVER Training in Pune Slides
SQL SERVER Training in Pune Slidesenosislearningcom
 
Amazon Redshift: Performance Tuning and Optimization
Amazon Redshift: Performance Tuning and OptimizationAmazon Redshift: Performance Tuning and Optimization
Amazon Redshift: Performance Tuning and OptimizationAmazon Web Services
 
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 systemssamiullahamjad06
 
Implementing the Databese Server session 02
Implementing the Databese Server session 02Implementing the Databese Server session 02
Implementing the Databese Server session 02Guillermo Julca
 
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytWrushabhShirsat3
 

Similar a 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
 
unit-ii.pptx
unit-ii.pptxunit-ii.pptx
unit-ii.pptx
 
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
 
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
 

Más de 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 8Mohd 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 7Mohd 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 5Mohd 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 4Mohd 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 3Mohd 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 2Mohd 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 1Mohd Harris Ahmad Jaal
 

Más de 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
 

Último

call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 

Último (20)

call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 

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