Title: 2) Modify the php.ini to case of php.ini
1- 2) Modify the php.ini to case of php.ini
- 3) Apaches PHP configuration directires
2MYSQL
- A data base used by many large websites, because
it is easily accessed through the Phpmyadmin
interface. this interface let you view all the
tables of your database. - The columns and information of each table and
make changes or run queries. -
3MYSQLs Popularity
- Mysql lunched in 1995, has become the most
popular open source database system. - Virtually all web provides includes Mysql as part
of their hosting plan. Often on the ubiquitous
LAMP(Linux, Apache, Mysql, Php) platform
4- MYSQLs popularity has been the ongoing success
of PhpMyadmin - Many websites use mysql as their backend database
repository.
5What is phpMyadmin
- It is a visual system for the management of mysql
database. Its written in PHP and serves to
display the contents of database on the server(or
client) on which mysql is installed. Through this
interface you can - 1) create database
- 2) modify existing ones and modify and modify
the contents of the single fields
6PHPMYADMIN
- What is features make mysql different from other
database. - some of the main reason are
- Free
- Easy installation
- Easy integration with PHP
7The distinction between MYSQL and SQL
- MYSQL
- is the database server software yhat you are
using - SQL
- is the language that you use to interact with
that database.
8Core features of MYSQL
- Portability
- MYSQL runs on almost every platform of
- Unix, window and MACOSX and ., MYSQL runs
whatever operating system you have available. - SPEED
- using techniques as efficient indexing
mechanisms. MYSQL executes most queries much
faster than most other database system.
9- Scalability
- because its modularity
and its flexibility in configuration in
configuration. MYSQL can run in systems varying
(unreliable) in size from embedded system to
large multiprocessor Unix with ten million users
records - Flexibility
- MYSQL let you choose the
table types have many of parameters.
10- Ease to use
- MYSQL is easy to install
and administer. Other database needs require
specification knowledge and training , and can
be installed less than ten minutes. - Fine grained security model
-
you can restricted users rights from an entire
database down to the column level based on login
name , password and hostname that users not
connecting from
11- Access from other language/systems
12EXAMPLE
- MYSQLgt Create table joke(
- -gtID INT NOTNULL AUTO-INCREMENT PRIMARY KEY,
- -gt joketext TEXT ,
- -gt jokedate DATE NOTNULL,
- -gt
13Lets break it down
- in first line, we want to create a new table
named joke. - The second line says that, we want column called
(ID), that will contain an integer(INT), that is
a whole number. The rest of this line deals with
special details for the column. - First , this column is not allowed be left
blank(NOT NULL) -
-
14- We want MYSQL to pick a value is one more
- than the highest value in the table so far
- (AUTO-Increment).Finally, this column is to act
as a unique indentified in this column must
unique(PRIMARY KEY) - In third line is super-simple, it says that want
a column called joketext , which contain
text(text)
15- The fourth line define our last column, called
jokedate which will contain data of type DATE and
which can not be left blanks(NOT NULL)
16NAVIGATION BAR INCLUDES
- Structure
- SQL
- EXPORT
- SEARCH
- QUERY
- DROP
17http//localhost/mysql/
18 PHPMyAdmin Tutorial
- Once you have a MySQL database and user account
setup you are generally given a link or URL to a
PHPMyAdmin control panel. This is a GUI that
allows you to manage your MySQL database. - There are other GUIs available for MySQL but
PHPMyAdmin is by far the most popular
19http//localhost/mysql/
- Once you are logged in, a PHPMyAdmin screen
appears as shown below. This screen may differ
depending on the version of PHPMyAdmin that is
running. - As you see by the image permission to create new
databases is not generally set so you will need
to select from the list of available databases to
begin to create and manage your MySQL tables.
20Layout of PhpMyadmin
21- CREATE TABLE contacts (id int NOT NULL
auto_increment,firstname char(40) NOT
NULL,lastname char(40) NOT NULL,phone
char(20),email char(40),address text,category
char(20),yearofbirth int DEFAULT '0',private
tinyint DEFAULT '0',PRIMARY KEY (id))
22- To begin adding data into your database you must
create a table. For best results your table name
should be all lowercase with no spaces. Use and
under-score "_" to separate words. e.g.
my_table_name. For this example we will create a
table with 5 fields called my_new_table inside
the database called test.
23create a table with 5 fields called my_new_table
inside the database called test
When you click Go you will be brought to the
Create a new table page with a form you must fill
out to create the new table. Each field has
options applied to it on this page that will
define the field type, size, name, and more
24Field Options
- Field
- is the name of the field - this should
be lower case with no spaces and an underscore
used for spaces for best results. e.g.
my_field_name. - Type
- is the type of data that will be stored
inside this field - default is VARCHAR. You can
learn more about data types in MySQL by going to - http//dev.mysql.com/doc/refman/5.0/en/data-types.
html - Length/Values -
- is generally the number of characters
allowed in the field - i.e. for a zip code you
might have a length of 5. - Collation
- is the character set for the field -
generally this is not set and the default for the
table is automatically used.
25- Attributes
- are special attributes that can be set
for the field - this may not apply for all field
types and is not necessary in this tutorial. - Null
- choose between not null and null -
not important for most users. - Default
- is the default value for the field - for
instance if you wanted a zip code to be placed in
if no value is given you would put the desired
default in here. - Extra
- choose to auto_increment a fields value
which is very useful and most users use for every
table. This is used most commonly to assign a
unique id to each row so that a specific row can
be called for using only one unique identifier.
The first value automatically put into this type
of field is generally 0, the next would be 1,
then 2, 3, etc.
26- Primary - both index and unique.
- Index - an index field is like a tab in a binder
that allows MySQL to find all the related data on
that topic faster. - Unique - a unique field is a field that has a
value in its row that is not found in any other
row. If an attempt is made to add a row with a
duplicate value for that row an error is
returned. - Fulltext -
- The rest of the parameters for fields will not be
covered and are not used for most database
tables.
27(No Transcript)
28- Create a table called customers CREATE TABLE
customers ( id INT UNSIGNED NOT NULL
AUTO_INCREMENT , name VARCHAR( 128 ) NOT NULL ,
email VARCHAR( 128 ) NOT NULL , PRIMARY KEY (
id ) ) COMMENT 'Customers'
29Example
- Create a table called newsletters CREATE TABLE
newsletters ( id INT UNSIGNED NOT NULL
AUTO_INCREMENT , name VARCHAR( 128 ) NOT NULL,
PRIMARY KEY ( id ) ) COMMENT 'Newsletters'
30Insert just some values to both tables to have a
testing basis
- INSERT INTO newsletters (name ) VALUES
('Business News'), ('Corporate News'), ('Personal
News') INSERT INTO customers (name , email
) VALUES ('John Doe', 'john_at_doe.org'), ('No
Body', 'no_at_body.org'), ('utilized',
'me_at_slashdot.org')
31Exercise
- Customers
- id
- name
- address
- Cars
- id
- manufacturer
- model
- Companies
- id
- name
- address
- Source of supply
- cars_id Carsid
- companies_id Companiesid
- Sales
- cars_id Carsid
- customers_id Customersid
32- CREATE TABLE customers ( id INT UNSIGNED NOT
NULL AUTO_INCREMENT , name VARCHAR( 255 ) NOT
NULL , address VARCHAR( 255 ) NOT NULL ,
PRIMARY KEY ( id ) ) COMMENT 'Customers' - CREATE TABLE cars ( id int(10) unsigned NOT
NULL auto_increment, manufacturer varchar(255)
NOT NULL default '', model varchar(255) NOT
NULL default '', PRIMARY KEY (id) )
COMMENT'Cars' - CREATE TABLE companies ( id INT UNSIGNED NOT
NULL AUTO_INCREMENT , name VARCHAR( 255 ) NOT
NULL , address VARCHAR( 255 ) NOT NULL ,
PRIMARY KEY ( id ) ) COMMENT 'Companies' - CREATE TABLE source_of_supply ( cars_id INT
UNSIGNED NOT NULL , companies_id INT UNSIGNED
NOT NULL , INDEX ( cars_id ), INDEX
(companies_id ) ) COMMENT 'Source of Supply'
- CREATE TABLE sales ( cars_id INT UNSIGNED NOT
NULL , customers_id INT UNSIGNED NOT NULL ,
INDEX ( cars_id ), INDEX ( customers_id ) )
COMMENT 'Sales'
33Web applications are by nature distributed
applications. In particular, this means that one
part of the application is executed on the web
server while another runs on the client computer
within a web browser window
34storage engineStorage Engine types in
Phpmyadmin
- MySQL can use several different formats for
storing data on disk, these are called storage
engines or table types. phpMyAdmin allows a user
to change their storage engine for a particular
table through the operations tab.
35Servers Kernel
36What is a Storage Engine?
- Data formats on Disk
- Examples
- Innodb
- MyISAM
- BDB
- Cluster
- HEAP
- CSV
- Yours!
37Business Enabler
- One of the features of MySQL database server is
Independent Storage Engines. - Transactional support InnoDB storage engine
- Non-transactional support MyISAM, HEAP storage
engine - Company Slashdot
38- independent storage engines which enable users to
choose the type of database storage that best
suits their needs. Storage engines are
essentially table types. - For example, for transactional support MySQL
offer InnoDB storage engine for and for
non-transactional storage engines there are HEAP
in-memory storage engine and the MyISAM standard
read-only storage engines. These
non-transactional storage engines are best for
logging and read/write mostly applications. - Slashdot uses InnoDB to manage its large, high
performance database. The company uses the MySQL
replication feature on InnoDB tables. - Slashdot, an award-winning news discussion site,
the system handles up to 180 queries per second.
All the users information, story information and
comment text are stored in InnoDB. - Brian Aker, senior architect at Slashdot
commented that InnoDB is easy to use, highly
reliable and it is battle-tested by the Open
Source community.
39mysql_close()
- This is a very important command as it closes
the connection to the database server. Your
script will still run if you do not include this
command but too many open MySQL connections can
cause problems for a web host. It is good
practice to always include this line once you
have issued all your commands to the database, to
keep the server running well.
40What is PHP?
- The PHP Hypertext Preprocessor is a programming
language that allows web developers to create
dynamic content that interacts with databases.
PHP is basically used for developing web based
software applications.
41PHP
- PHP is a powerful server-side scripting language
for creating dynamic and interactive websites. - PHP is the widely-used, free, and efficient
alternative to competitors such as Microsoft's
ASP. PHP is perfectly suited for Web development
and can be embedded directly into the HTML code. - The PHP syntax is very similar to Perl and C. PHP
is often used together with Apache (web server)
on various operating systems. It also supports
ISAPI and can be used with Microsoft's IIS on
Windows. - A PHP file may contain text, HTML tags and
scripts. Scripts in a PHP file are executed on
the server.