Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
23 views
20 pages
Iwd Unit 5 Working With Database
This is a pdf of unit 5 subject of semester fourth
Uploaded by
Moviez king
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save iwd-unit-5-working-with-database For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
23 views
20 pages
Iwd Unit 5 Working With Database
This is a pdf of unit 5 subject of semester fourth
Uploaded by
Moviez king
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save iwd-unit-5-working-with-database For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save iwd-unit-5-working-with-database For Later
You are on page 1
/ 20
Search
Fullscreen
e: Introduction to Web Development Unit -V Subject Code: 4340704 Unit — 5 Working With Database in PHP Introduction to MySQL Database with PHP ‘Overview of the database © Database: A database is simply an organized collection of related data, typically stored on disk, and accessible by possibly many concurrent users. ‘© Databases are generally separated into application areas. ‘© For example, one database may contain Human Resource (employee and payroll) data; another ‘may contain sales data; another may contain accounting data; and soon. ‘* Databases are managed by a DBMS. ‘* DBMS: Database Management System (DBMS) is a set of programs that manages any number of databases. Introduction to MySQL © MySQL is a database system used on the web ‘* MySQL is a database system that runs on a server ‘© MySQL is ideal for both small and large applications © MySQL is very fast, reliable, and easy to use, MySQL uses standard SQL. MySQL compiles on a number of platforms. MySQL is free to download and use, MySQL is developed, distributed, and supported by Oracle Corporation Data type of MySQL: ‘* MySQL Data Types are divided into three main categories as given below (1) Numeric DataType (2) String or Text DataType (3) Date Time Data Type © Numeric Datatype TINYINT 1 Itis used to store integer values. 2 SMALLINT 2) tis used to store integer values. 3 MEDIUMINT Bi Itis used to store integer values. Prepared By: Department of Computer Engineering Page 1Subject Name: Introduction to Web Development Unit-V Subject Code: 4340704 eeu 4 INT 4 It is used to store integer values. 5 BIGINT 8 Lis used to store integer values. 6 FLOAT 4 It is used to store single precision floating point value. 7 DOUBLE 8 _Itis used to store double precision floating point value 8 DECIMAL tis used to store integer values. String Datatype tis used to store fixed length string. 2. VARCHAR 255 Itis used to store variable length string. 3. TINYBLOB 255 tis used to store short binary data. 4 TINYTEXT 255 tis used to store short text string, 5 BLOB 65535 _It is used to store large binary data. 6 TEXT 65535 _It is used to store large text string. 7 MEDIUMBLOB —_—_16777215 _It is used to store medium binary data. 8 MEDIUMTEXT — 16777215 _Itis used to store medium text string. 9 LONGBLOB 4294967295 It is used to store extremely large binary data, 10 LONGTEXT 4294967295 It is used to store extremely large text string © Date and Time Datatype Tris used to store date values in the YYYY ~ MM ~ DD Format. Prepared By: Department of Computer Engineering Page 2Code: 4340704 e: Introduction to Web Development Unit -V It is used to store time values or time duration in the a ate a HH : MM: SS format. 3 YEAR 1 It is used to year values in the YYYY format. 4 DATETIME 8 ee Nig ait inthe YYYY 1S Eee Field Modifiers in PHP’ | NULL or NOT NULL : ‘© Itallows you to specify weather the field can accept null value or you must have to enter value for that field. © You can specify this modifier at the end field definition. © By default all the filed of the table having this modifier set to NULL. o Example create table Subject ( SubjectCode varchar (5) NOT NULL, SubjectName varchar (10) NOT NULL, SubDesc varchar (20) NULL ) « DEFAULT © Default modifier allows you to specify default value for the field so if you don’t enter any value for that field then default value is used. o Example create table Subject ( SubjectCode varchar (5) NOT NULL, SubjectName varchar (10) NOT NULL, SubDese varchar (20) DEFAULT ‘Computer’ ) * AUTO_INCREMENT © This modifier automatically increments the value of field by one, © There is no need to insert explicit value for this field. © It is widely used in primary key field where unique id is generated automatically by MySQL each time by incrementing previous by I. © However you can specify AUTO_INCREMENT modifier for only INT data type. © Example: create table Subject ( SubjectCode INT(5) AUTO_INCREMENT, SubjectName varchar (10) NOT NULL, SubDese varchar (20) NULL, ) ‘Types of MySQL tables & storage engines Prepared By: Department of Computer Engineering Page 3Subject Nami e: Introduction to Web Development Unit -V Subject Code: 4340704 ‘+ When we create table using Create Table statement it is also possible to specify type of the table using TYPE attribute as shown below Create table TableName (ColumnNameDataType, ColumnNameDataType ) TYPE = TableType ‘* Following are the various Types of MySQL tables that you can specify at the time of creating new Database Table. MyISAM ISAM HEAP InnoDB BDB pre we «| MyISAM © While creating Table if you don’t specify the type of the Database Table then by default its type is set to MYISAM. © This table is portable, Portable means the table created using this type in one OS can also be used in other OS. It supports large table file more than 4GB. It is well suited for faster access then speed. Itallows you to reduce the space using compression. Itallows you to specify index on BLOB as well as TEXT type. coon « ISAM © This Table Type is similar to the MyISAM table type in the way it also supports fixed size as well as dynamic size table. © Butt is different from MYISAM table type in following way : = Itcan support table files up to 4GB but not grater then 4GB. = Tis not portable. Means table created using this type in one OS cannot use in other Os. * It does not allow faster accessing and compression. * Since maximum key length in this table type is 256 it does not allows you to specify index on BLOB and TEXT type. + HEAP © This table type is widely used for temporary tables because it supports incredible speed. © Itis in-memory table which uses hashed indices. © It does not allow BLOB and TEXT type as MYISAM and ISAM type. + BDB © BB isalso known as Berkeley DB. Prepared By: Department of Computer Engineering Page 4e: Introduction to Web Development Unit -V Subject Code: 4340704 This table type is transaction safe and widely used for transaction. It supports very large applications with more than one users trying to insert and update the same data at the same time. It allows you the facility of transaction using commit and roliback statement, One important facility provided by this table type is that allows you the facility of recover data from crashes. It is not portable because the path of the table i the table. hardwired into the table file while creating + ImoDB ° ° This table type is also transaction safe It supports very large applications with more then one users trying to insert and update the same data at the same with locking mechanism. Locking mechanism prevents users from modifying records while another user is ‘modifying the same record at the same time. Italso allows you the facility of recovering data from crashes. This table type is portable. This table type is useful for virtual table, This table type can be created by joining more than one MyISAM table types into single table. However you can join more than one MyISAM table if and only if all the table having same structure. Prepared By: Department of Computer Engineering Page 5‘Subject Name: Introduction to Web Development Unit-V Subject Code: 4340704 Creating a database using phpmyadmin & Console ‘+ Creating a database using phpmyadmin 6 Run wampserver and Click on wampserver icon © Provide “root” username and click on Go button phpMyAdmin Welcome to phpMyAdmin Language English w Login Username: wad Passmore: ———— server Chote: ysau Prepared By: Department of Computer Engineering Page 6‘Subject Name: Introduction to Web Development Unit -V Subject Code: 4340704 a © On phpMyAdmin dashboard, click on Databases option ‘asnee end eeeaeaednaaeedineeenlanaaeena ay =n Se eer Ss ee Soros (oe — 2 eS eee ies Erne wlomoee oem s Co cd Prepared By: Department of Computer Engineering Page 7‘Subject Name: Introduction to Web Development Unit-V Subject Code: 4340704 TT © Now “GTU" database is created. phpMyAdmin uistiee | H meme ie 5 tri ti rtf tt | tt wea | amen ‘* Creating a database using console co Run wampserver and Click on wampserver icon © Now Click on MySQL option Ei Apache 2a belly rv 5635 Fey Mosca. 572 S er 10234 Pep) sta Al Services ES) stop al senices KY eta Al Serices Bs ror c/namp orPHP in PATH epartment of Computer Engineering Page &Subject Name: Introduction to Web Development Unit -V Subject Code: 4340704 © Click on MySQL console option |B version ¥ Service administration ‘wampmysqid’ ) MySQL settings BB M50 console 12 mys (2 MysQt og [Ed Myst documentation Stop All Services Restart All Services Zod 6) Error c/vamp or PHP in PATH © Provide username “root” and click on OK button Enter 2 vaid usemame. If you don't know, ‘een oot by defautt. rool) Coe) (ones) Prepared By: Department of Computer Engineering Page 9Subject Name: Introduction to Web Development -V Subject Code: 4340704 As “root” username have no password press enter key inmysqlmysalS 7.20\bin\mysal exe © Now type a sql statement to create an database “211¢¢2”, “create database 21ce2 57.2Nbin\mysqlexe = aa a : ee Perey Champ binmysql my ST Cee rd See eeaet tre Caen eC] Prepared By: Department of Computer engineering Page 10‘Subject Name: Introduction to Web Development Unit -V Subject Code: 4340704 ‘+ Creating a database using PHP script Performing database operations ‘© mysqli_fetch_rows( ) © This function allows you to retrieve a record from the record set that is returned from executing the MySQL query. co The record that is returned by this function is in the form of numeric array. Numeric array contains index and value associated with that index. © If there is no record in the record set then it returns false value. © Syntax : mysqli_fetch_rows ($VariableName) ; Variable Name: Indicates the record set that is returned from executing the MySQL. command using mysqli_query () function, o Example: Write a php seript to search a record from database. "; } mysqli_close(Scon); > Prepared By: Department of Computer Engineering Page 13e: Introduction to Web Development Unit -V Subject Code: 4340704 © This function allows you to retrieve a record from the record set that is returned from executing the MySQL query. © The record that is returned by this function is in the form of numeric array, associative array or both. © If there is no record in the record set then it returns false value. © Syntax: mysqli_fetch_array ($VariableName, ArrayType) ; Here, Variable Name : Indicates the record set that is retumed from executing the MySQL command using mysqli_query () function, © Array Type indicates the type of the array to be returned. © It can have one of the following value : (1) MYSQL_ASSOC : This type of array contains name of the field and the value associated with that field for current record, (2) MYSQL_NUM : This type array contains index of the field and the value associated with that index for current record. (3) MYSQL_BOTH : It is combination of both Associative array and Numeric array. Tt is the default type to be returned by this function, o Example :
‘+ Update data into the table + Retrieve data from the table
”; I mysqli_close($con); > Prepared By: Department of Computer Engineering Page 17‘Subject Name: Introduction to Web Development Unit-V Subject Code: 4340704 ‘* Delete data from the table isplaying data from the database in different formats, including tables * Display data from the database in tabular format 0) { echo “stable border=1>"; echo “
Enrollment No
”; echo “
Student Name
”; echo “
Semester
”; while (Sres=mysqli_fetch_row(Sans)) { echo "
$res[0]
”; echo “
Sres[]s/td>”; echo “
Sres[2}
”: echo “
Sres[3}s/td>
"; Prepared By: Department of Computer Engineering Page 18Unit -V Subject Code: 4340704 echo “No record Found”; I mysqli_close($con); Hosting a Website FTP is stands for File Transfer Protocol. ‘¢ Ibis a system that allow you to log in to a server and upload, download or modify content. © FileZilla is powerful and free software for transferring file over the internet. © Once you have the FileZilla client downloaded and activate on your system, enter the domain name in the address field. ‘* The Username and password you need to type in are the same as the ones you use to log in to your cPanel. ‘+ Connect toa web server © In the FileZilla QuickConnect bar at the top of the page, enter your website URL in the host field. © Enter your FTP usemame and password. © Click QuickConnect. 27 RITTS) Chew viz ace es ee — wareae Te T= = il vinaowe x Prepared By: Department of Computer Engineering Page 19: Introduction to Web Development Unit -V Subject Code: 4340704 © While FileZilla connect to your web server, a number of messages dis log. © Once you are successfully connected to web server, the folder structure of your webserver display in the Remote Site pane in FileZilla. lay in the message ‘+ Transfer file to website © In the local site pane, navigate to the location of your website. Select the files you want to upload to the website. You can select multiple files. Drag the files you want to transfer from the Local site pane to Remote Site Pane. FileZilla automatically transfer your files to your website. When you are finished uploading your files, close FileZilla and check your website in browser. e000 Hort: pdemouicem Username admin eel _) Coico) Baus Conecng io TEES BET Status Conmecton estate wating for welcome message. Stas: —_‘IntoingS.- Status: Vein cea Stas TS cannerbon esabihed Sats Logged Seas: Rereng deny Commné PO Response 257 inyeurcurtocaton Commune TYPE Resjorse —_BOTVPE snow b-bbiay Commun PASI Prepared By: Department of Computer Engineering Page 20
You might also like
Basics of PHP & MySQL
PDF
100% (9)
Basics of PHP & MySQL
7 pages
PHP Unit 5
PDF
No ratings yet
PHP Unit 5
8 pages
SQL Labsheets
PDF
100% (1)
SQL Labsheets
98 pages
PHP 13
PDF
No ratings yet
PHP 13
57 pages
UNIT 5-Part 1
PDF
No ratings yet
UNIT 5-Part 1
9 pages
5.introduction To MySQL
PDF
No ratings yet
5.introduction To MySQL
54 pages
Basic PHP Database MYSQL For Beginners
PDF
100% (4)
Basic PHP Database MYSQL For Beginners
21 pages
Unit I: Introduction To Mysql
PDF
100% (1)
Unit I: Introduction To Mysql
39 pages
Creating Databases Tables and Indexes
PDF
100% (1)
Creating Databases Tables and Indexes
45 pages
Chapter 5 SQL
PDF
No ratings yet
Chapter 5 SQL
41 pages
Chapter 6 SQL
PDF
No ratings yet
Chapter 6 SQL
37 pages
PHP MySQL Module IV
PDF
No ratings yet
PHP MySQL Module IV
15 pages
PHP MySQL Create Table
PDF
No ratings yet
PHP MySQL Create Table
2 pages
Chapter 3 Database Manipulation
PDF
No ratings yet
Chapter 3 Database Manipulation
41 pages
Unit 5
PDF
No ratings yet
Unit 5
22 pages
PHP Database
PDF
No ratings yet
PHP Database
20 pages
Introduction To Mysql & PHP: Presented By, M.Pravin Raj
PDF
No ratings yet
Introduction To Mysql & PHP: Presented By, M.Pravin Raj
14 pages
Mysql
PDF
No ratings yet
Mysql
24 pages
Creating and Manipulating Tables in Mysql 1. Creating A Table in Mysql
PDF
100% (1)
Creating and Manipulating Tables in Mysql 1. Creating A Table in Mysql
7 pages
PHP Part3
PDF
No ratings yet
PHP Part3
19 pages
MySql CreateDB Tables
PDF
No ratings yet
MySql CreateDB Tables
7 pages
Mysql Storage Engines and Data Types
PDF
No ratings yet
Mysql Storage Engines and Data Types
4 pages
Laboratory Manual On MYSQL For Year IV Database Students (Power and Control Engineering Stream Students)
PDF
No ratings yet
Laboratory Manual On MYSQL For Year IV Database Students (Power and Control Engineering Stream Students)
20 pages
Lec4 - Mysql - PHP
PDF
No ratings yet
Lec4 - Mysql - PHP
41 pages
Unit3 PHP
PDF
No ratings yet
Unit3 PHP
20 pages
My SQL (Basic)
PDF
100% (2)
My SQL (Basic)
52 pages
DWPD GTU Study Material E-Notes Unit-5 03082019063134AM PDF
PDF
No ratings yet
DWPD GTU Study Material E-Notes Unit-5 03082019063134AM PDF
16 pages
Unit - IV (Database Handling in PHP& Mysql)
PDF
No ratings yet
Unit - IV (Database Handling in PHP& Mysql)
6 pages
Lecture 15 - MySQL - PHP 1
PDF
No ratings yet
Lecture 15 - MySQL - PHP 1
81 pages
RDBMS
PDF
No ratings yet
RDBMS
24 pages
PHP MySQL Create Database and Tables
PDF
No ratings yet
PHP MySQL Create Database and Tables
3 pages
PHP 5 and Mysql Database
PDF
No ratings yet
PHP 5 and Mysql Database
19 pages
Unit 5 Working With Database in PHP 5.1 To 5.4
PDF
No ratings yet
Unit 5 Working With Database in PHP 5.1 To 5.4
37 pages
SQL To PHP
PDF
No ratings yet
SQL To PHP
15 pages
Chap 7 PHP MySQL Database
PDF
No ratings yet
Chap 7 PHP MySQL Database
33 pages
Mysql Is An: Open-Source Relational Database Management System
PDF
No ratings yet
Mysql Is An: Open-Source Relational Database Management System
22 pages
Lecture 7-Using Database
PDF
No ratings yet
Lecture 7-Using Database
28 pages
Selecting Mysql Database From Command Prompt:: Numeric Data Types
PDF
100% (1)
Selecting Mysql Database From Command Prompt:: Numeric Data Types
7 pages
L23 - Mysql 1
PDF
No ratings yet
L23 - Mysql 1
49 pages
Lecture 15 - MySQL - PHP 1
PDF
No ratings yet
Lecture 15 - MySQL - PHP 1
81 pages
Phpmyadmin DB Notes
PDF
No ratings yet
Phpmyadmin DB Notes
25 pages
11 Mysqlnotespdf
PDF
No ratings yet
11 Mysqlnotespdf
22 pages
Computer 3
PDF
No ratings yet
Computer 3
18 pages
PHP 09 MySQL
PDF
No ratings yet
PHP 09 MySQL
58 pages
SQL Database
PDF
No ratings yet
SQL Database
13 pages
Lab Sheet 1
PDF
No ratings yet
Lab Sheet 1
18 pages
MySQL Interview Questions
PDF
No ratings yet
MySQL Interview Questions
14 pages
PHP Unit V
PDF
No ratings yet
PHP Unit V
15 pages
Chapter 5
PDF
No ratings yet
Chapter 5
14 pages
Unit-5 Working With Database in PHP
PDF
No ratings yet
Unit-5 Working With Database in PHP
14 pages
DWPD GTU Study Material E-Notes Unit-5 22092020071825AM
PDF
No ratings yet
DWPD GTU Study Material E-Notes Unit-5 22092020071825AM
16 pages
Advantages of Mysql: Q:-1 What Is Mysql?
PDF
No ratings yet
Advantages of Mysql: Q:-1 What Is Mysql?
9 pages
MySQL Tutorial
PDF
No ratings yet
MySQL Tutorial
8 pages
Chapter01 Lesson04
PDF
No ratings yet
Chapter01 Lesson04
43 pages
Creating Database: Managing Databases in Mysql
PDF
No ratings yet
Creating Database: Managing Databases in Mysql
56 pages
Chapter 5 of PHP (WBP)
PDF
No ratings yet
Chapter 5 of PHP (WBP)
25 pages
My SQL
PDF
No ratings yet
My SQL
8 pages
Chap 8
PDF
No ratings yet
Chap 8
6 pages
Slide MySql
PDF
No ratings yet
Slide MySql
22 pages