SlideShare a Scribd company logo
Introduction to
MySQL & PHP
MySQL & PHP, presented by Vibrant
Technology & Computers
1
MySQL & PHP, presented by Vibrant
Technology & Computers
2
MySQL & PHP, presented by Vibrant
Technology & Computers
3
History of SQL
1974 - First version of SQL developed by Donald Chamberlin and Raymond
Boyce at IBM (SEQUEL). Used to manipulate and retrieve data in their
database.
1986 - American National Standards Institute (ANSI) standardizes SQL-86.
1999 – SQL3 supports new features like procedural & control-of-flow
statements, triggers, and regular expressions.
…..
2008 – SQL2008 - still modifying the language to date.
Popular SQL suppliers today
MySQL, Microsoft SQL Server, IBM DB2, Oracle 11g, PostgreSQLSQL
MySQL & PHP, presented by Vibrant
Technology & Computers
4
Basic SQL Syntax
âž” Data Definition Language (DDL)
• CREATE TABLE / DATABASE / VIEW / etc.....
• ALTER ...
• DROP ...
âž” Data Manipulation Language (DML)
• SELECT ... FROM / INTO … WHERE ...
• INSERT INTO ... VALUES ...
• UPDATE … SET … WHERE ...
• DELETE FROM … WHERE ...
MySQL & PHP, presented by Vibrant
Technology & Computers
5
MySQL Tutorial (1 of 2)
âž” Following from MySQL 5.1 Manual (3.3 Creating and using a database)
âž” For Command Prompt usage, follow these steps to use a database.
Enter password: XXXXX
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 4
Server version: 5.1.31-community MySQL Community Server (GPL)
Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
mysql> USE TEST;
Database changed
âž” You can now perform DML & DDL operations!
MySQL & PHP, presented by Vibrant
Technology & Computers
6
Intro to MySQL
âž” Released 23 May 1995.
âž” 11+ Million web servers using MySQL
âž” Similar, but not exactly same syntax as IBM DB2, Oracle 11g, etc...
âž” Open-source & free to download, under the GNU General Public
License.
âž” Coded in C / C++, Yacc parser, and custom lexical analyzer.
MySQL & PHP, presented by Vibrant
Technology & Computers
7
MySQL Tutorial (2 of 2)
mysql> CREATE TABLE myTest (time DATE, note VARCHAR(10), id INT);
Query OK, 0 rows affected (0.11 sec)
mysql> DESCRIBE myTest;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| time | date | YES | | NULL | |
| note | varchar(10) | YES | | NULL | |
| id | int(11) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
3 rows in set (0.05 sec)
mysql> INSERT INTO myTest VALUES (NULL, "hello", 3);
Query OK, 1 row affected (0.05 sec)
mysql> SELECT * FROM myTest;
+------+-------+------+
| time | note | id |
+------+-------+------+
| NULL | hello | 3 |
+------+-------+------+
1 row in set (0.01 sec)
mysql>
MySQL & PHP, presented by Vibrant
Technology & Computers
8
History of PHP
1994 - Rasmus Lerdorf wrote Common Gateway Interface (CGI) Binaries.
1995 - Personal Home Page Tools (PHP Tools) formed.
1997-8 - Zeev Suraski & Andi Gutmans wrote PHP parser. Their PHP3
became the PHP: Hypertext Preprocessor.
To 2008 - Various improvements & bug fixes.
➔ Old versions of PHP – Code not compiled. Only interpreted and run.
âž” After PHP4, Parser compiles input to produce bytecode for Zend Engine
processing.
MySQL & PHP, presented by Vibrant
Technology & Computers
9
Intro to PHP
âž” PHP file runs on web server, inputs PHP code, compiles to bytecode,
outputs Web Pages.
âž” Creates Dynamic Web Pages, using Server Side Scripting. (like .asp, .jsp,
perl). Clients “Run” these web pages when visited.
➔ Similar programming structure / syntax as C or Javascript. Other “Tools”
included in PHP releases like ImageJPEG($im,$destpic,
$jpeg_thumb_quality);
âž” HTML (markup language) usually used along with PHP.
MySQL & PHP, presented by Vibrant
Technology & Computers
10
PHP Syntax
âž” <?php PHP code here ?>
âž” $variable //automatic type detection on assignment.
âž” $ is escape character for variables within double quotes
➔ $newVar = “$string1 hihi!” //replaces $string1 with its value.
➔ “Double quotes” = variable replacement
âž” 'Single quotes' = literal string
âž” That 3rd
set of quotes (`???`) = some other use
âž” function generateThumbnail($sourceImg, $destImg){ }
MySQL & PHP, presented by Vibrant
Technology & Computers
11
PHP Examples
MySQL & PHP, presented by Vibrant
Technology & Computers
12
Some MySQL + PHP
Uses
âž” Managing database from the web. Phymyadmin is a commonly used
remote database management system via a PHP interface.
âž” User places buy order on your website, and info is stored in DB.
âž” Progressively build a SQL Query string.
âž” PHP can blend with anything else on an HTML webpage, and even
dynamically generate more web code.
âž” Make and test your own website / program.
MySQL & PHP, presented by Vibrant
Technology & Computers
13
PhpMyAdmin
MySQL & PHP, presented by Vibrant
Technology & Computers
14
MySQL + PHP
Need a web server that connects to a local or remote Database?
No problem!
Host most likely “localhost”.
To perform SQL commands, try this php function...
$sql = mysql_query(“SELECT * FROM myTable);
Just like with Java and its JDBC.
There is a way to iterate through the resulting bag.
MySQL & PHP, presented by Vibrant
Technology & Computers
15
List all query results Ex.
MySQL & PHP, presented by Vibrant
Technology & Computers
16
PHP Control Structure Ex.
PHP is much like C, Java, or Javascript in some ways.
This will print 0123456789
MySQL & PHP, presented by Vibrant
Technology & Computers
17
Form Post Ex. (1 of 2)
• Test.php is purely HTML.
• Form's POST action sends the object names to PHP file.
• PHP file extracts them with array $_POST[].
MySQL & PHP, presented by Vibrant
Technology & Computers
18
Form Post Ex. (2 of 2)
MySQL & PHP, presented by Vibrant
Technology & Computers
19
How do I get PHP or MySQL?
Mysql.com (100 MB)
php.net (for reference)
Some web server, like Apache or Wampserver will work.
For the examples, I used Wampserver (wampserver.com) (16 MB)
1. Installed MySQL
2. created some new tables with mysql
3. installed Wampserver
4. make .PHP files and put them in the www folder
5. Go to http://localhost/my.php
6. test your code.
MySQL & PHP, presented by Vibrant
Technology & Computers
20
MySQL-PHP Conclusion
âž” MySQL is open-source and PHP is open-library.
âž” MySQL and PHP work well together.
âž” Free. Fairly simple and familiar to program with.
âž” MySQL is fast enough, but PHP is fairly slow.
âž” Many real-world applications on-line or even in a local network.
âž” If you are sick of MySQL command line, go get a web server with
PhpMyAdmin.
MySQL & PHP, presented by Vibrant
Technology & Computers
21
References
1. http://www.mysql.com
2. http://www.php.net/mysql
3. http://www.wampserver.com
4. http://en.wikipedia.org/wiki/SQL
5. http://en.wikipedia.org/wiki/Mysql
6. http://en.wikipedia.org/wiki/Php
Thank You…
MySQL & PHP, presented by Vibrant
Technology & Computers
22

More Related Content

PPT
Php classes in mumbai
PPTX
1
PDF
Ruby meetup ROM
PDF
Java features. Java 8, 9, 10, 11
PDF
Database schema management in Ruby apps
PPTX
MuleSoft ESB scatter-gather and base64
ODP
PHP BASIC PRESENTATION
PPTX
PHP 5.6 New and Deprecated Features
Php classes in mumbai
1
Ruby meetup ROM
Java features. Java 8, 9, 10, 11
Database schema management in Ruby apps
MuleSoft ESB scatter-gather and base64
PHP BASIC PRESENTATION
PHP 5.6 New and Deprecated Features

What's hot (20)

PDF
Automating with ansible (Part c)
PDF
OpenCms Days 2014 - Using the SOLR collector
PPTX
MuleSoft ESB Scripting Example
PDF
OpenCms Days 2012 - OpenCms 8.5: Using Apache Solr to retrieve content
PPTX
10 Most Important Features of New PHP 5.6
PDF
CakePHP 3
PDF
Umleitung: a tiny mochiweb/CouchDB app
KEY
Wider than rails
PDF
MobaSiF::Template Introduction
PPT
MuleSoft ESB XML to CSV
PDF
Phorum MySQL tricks
PPTX
Integrate with database by groovy
PDF
extending-php
PDF
From One to a Cluster
PPTX
MuleSoft ESB Sending email using hmailserver
ODP
1. MySql plugins
PPTX
Overview of Puppet and Ansible
PDF
Mini Rails Framework
PDF
Doctrine Project
PPTX
Memcached B box presentation
Automating with ansible (Part c)
OpenCms Days 2014 - Using the SOLR collector
MuleSoft ESB Scripting Example
OpenCms Days 2012 - OpenCms 8.5: Using Apache Solr to retrieve content
10 Most Important Features of New PHP 5.6
CakePHP 3
Umleitung: a tiny mochiweb/CouchDB app
Wider than rails
MobaSiF::Template Introduction
MuleSoft ESB XML to CSV
Phorum MySQL tricks
Integrate with database by groovy
extending-php
From One to a Cluster
MuleSoft ESB Sending email using hmailserver
1. MySql plugins
Overview of Puppet and Ansible
Mini Rails Framework
Doctrine Project
Memcached B box presentation
Ad

Viewers also liked (9)

PPT
Php course-in-navimumbai
PDF
Enterprise PHP (php|works 2008)
PPSX
Php and MySQL
PDF
How to scale PHP applications
PDF
Beginning php 5 and my sql 5 from novice to professional
DOC
Creating a Simple PHP and MySQL-Based Login System
PPT
PHP Presentation
KEY
Object Relational Mapping in PHP
Php course-in-navimumbai
Enterprise PHP (php|works 2008)
Php and MySQL
How to scale PHP applications
Beginning php 5 and my sql 5 from novice to professional
Creating a Simple PHP and MySQL-Based Login System
PHP Presentation
Object Relational Mapping in PHP
Ad

Similar to Sql php-vibrant course-mumbai(1) (20)

PPT
PHP - Intriduction to MySQL And PHP
ODP
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
PDF
Squeak DBX
 
PDF
Using Ruby on Rails with legacy Oracle databases
PPT
Starting with PHP and Web devepolment
KEY
Site Performance - From Pinto to Ferrari
PPT
Download It
PDF
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
PPT
PHP - Introduction to PHP Date and Time Functions
ODP
Handling Database Deployments
PPT
Php intro
PPT
Php intro
PPT
Php intro
PPTX
Introduction to php
PPT
wamp.ppt
PPT
Mysql
PPT
PDF
Tutorial On Database Management System
PDF
20201106 hk-py con-mysql-shell
PHP - Intriduction to MySQL And PHP
HTTP, JSON, JavaScript, Map&Reduce built-in to MySQL
Squeak DBX
 
Using Ruby on Rails with legacy Oracle databases
Starting with PHP and Web devepolment
Site Performance - From Pinto to Ferrari
Download It
JavaScript and Friends August 20th, 20201 -- MySQL Shell and JavaScript
PHP - Introduction to PHP Date and Time Functions
Handling Database Deployments
Php intro
Php intro
Php intro
Introduction to php
wamp.ppt
Mysql
Tutorial On Database Management System
20201106 hk-py con-mysql-shell

Recently uploaded (20)

PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Cloud computing and distributed systems.
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
 
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Empathic Computing: Creating Shared Understanding
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Machine learning based COVID-19 study performance prediction
PPT
Teaching material agriculture food technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
DOCX
The AUB Centre for AI in Media Proposal.docx
 
PDF
KodekX | Application Modernization Development
 
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
cuic standard and advanced reporting.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Cloud computing and distributed systems.
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
 
MIND Revenue Release Quarter 2 2025 Press Release
Empathic Computing: Creating Shared Understanding
Review of recent advances in non-invasive hemoglobin estimation
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Per capita expenditure prediction using model stacking based on satellite ima...
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Spectral efficient network and resource selection model in 5G networks
Machine learning based COVID-19 study performance prediction
Teaching material agriculture food technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The AUB Centre for AI in Media Proposal.docx
 
KodekX | Application Modernization Development
 
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
cuic standard and advanced reporting.pdf

Sql php-vibrant course-mumbai(1)

  • 1. Introduction to MySQL & PHP MySQL & PHP, presented by Vibrant Technology & Computers 1
  • 2. MySQL & PHP, presented by Vibrant Technology & Computers 2
  • 3. MySQL & PHP, presented by Vibrant Technology & Computers 3 History of SQL 1974 - First version of SQL developed by Donald Chamberlin and Raymond Boyce at IBM (SEQUEL). Used to manipulate and retrieve data in their database. 1986 - American National Standards Institute (ANSI) standardizes SQL-86. 1999 – SQL3 supports new features like procedural & control-of-flow statements, triggers, and regular expressions. ….. 2008 – SQL2008 - still modifying the language to date. Popular SQL suppliers today MySQL, Microsoft SQL Server, IBM DB2, Oracle 11g, PostgreSQLSQL
  • 4. MySQL & PHP, presented by Vibrant Technology & Computers 4 Basic SQL Syntax âž” Data Definition Language (DDL) • CREATE TABLE / DATABASE / VIEW / etc..... • ALTER ... • DROP ... âž” Data Manipulation Language (DML) • SELECT ... FROM / INTO … WHERE ... • INSERT INTO ... VALUES ... • UPDATE … SET … WHERE ... • DELETE FROM … WHERE ...
  • 5. MySQL & PHP, presented by Vibrant Technology & Computers 5 MySQL Tutorial (1 of 2) âž” Following from MySQL 5.1 Manual (3.3 Creating and using a database) âž” For Command Prompt usage, follow these steps to use a database. Enter password: XXXXX Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 4 Server version: 5.1.31-community MySQL Community Server (GPL) Type 'help;' or 'h' for help. Type 'c' to clear the buffer. mysql> SHOW DATABASES; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | +--------------------+ 3 rows in set (0.00 sec) mysql> USE TEST; Database changed âž” You can now perform DML & DDL operations!
  • 6. MySQL & PHP, presented by Vibrant Technology & Computers 6 Intro to MySQL âž” Released 23 May 1995. âž” 11+ Million web servers using MySQL âž” Similar, but not exactly same syntax as IBM DB2, Oracle 11g, etc... âž” Open-source & free to download, under the GNU General Public License. âž” Coded in C / C++, Yacc parser, and custom lexical analyzer.
  • 7. MySQL & PHP, presented by Vibrant Technology & Computers 7 MySQL Tutorial (2 of 2) mysql> CREATE TABLE myTest (time DATE, note VARCHAR(10), id INT); Query OK, 0 rows affected (0.11 sec) mysql> DESCRIBE myTest; +-------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+-------------+------+-----+---------+-------+ | time | date | YES | | NULL | | | note | varchar(10) | YES | | NULL | | | id | int(11) | YES | | NULL | | +-------+-------------+------+-----+---------+-------+ 3 rows in set (0.05 sec) mysql> INSERT INTO myTest VALUES (NULL, "hello", 3); Query OK, 1 row affected (0.05 sec) mysql> SELECT * FROM myTest; +------+-------+------+ | time | note | id | +------+-------+------+ | NULL | hello | 3 | +------+-------+------+ 1 row in set (0.01 sec) mysql>
  • 8. MySQL & PHP, presented by Vibrant Technology & Computers 8 History of PHP 1994 - Rasmus Lerdorf wrote Common Gateway Interface (CGI) Binaries. 1995 - Personal Home Page Tools (PHP Tools) formed. 1997-8 - Zeev Suraski & Andi Gutmans wrote PHP parser. Their PHP3 became the PHP: Hypertext Preprocessor. To 2008 - Various improvements & bug fixes. âž” Old versions of PHP – Code not compiled. Only interpreted and run. âž” After PHP4, Parser compiles input to produce bytecode for Zend Engine processing.
  • 9. MySQL & PHP, presented by Vibrant Technology & Computers 9 Intro to PHP âž” PHP file runs on web server, inputs PHP code, compiles to bytecode, outputs Web Pages. âž” Creates Dynamic Web Pages, using Server Side Scripting. (like .asp, .jsp, perl). Clients “Run” these web pages when visited. âž” Similar programming structure / syntax as C or Javascript. Other “Tools” included in PHP releases like ImageJPEG($im,$destpic, $jpeg_thumb_quality); âž” HTML (markup language) usually used along with PHP.
  • 10. MySQL & PHP, presented by Vibrant Technology & Computers 10 PHP Syntax âž” <?php PHP code here ?> âž” $variable //automatic type detection on assignment. âž” $ is escape character for variables within double quotes âž” $newVar = “$string1 hihi!” //replaces $string1 with its value. âž” “Double quotes” = variable replacement âž” 'Single quotes' = literal string âž” That 3rd set of quotes (`???`) = some other use âž” function generateThumbnail($sourceImg, $destImg){ }
  • 11. MySQL & PHP, presented by Vibrant Technology & Computers 11 PHP Examples
  • 12. MySQL & PHP, presented by Vibrant Technology & Computers 12 Some MySQL + PHP Uses âž” Managing database from the web. Phymyadmin is a commonly used remote database management system via a PHP interface. âž” User places buy order on your website, and info is stored in DB. âž” Progressively build a SQL Query string. âž” PHP can blend with anything else on an HTML webpage, and even dynamically generate more web code. âž” Make and test your own website / program.
  • 13. MySQL & PHP, presented by Vibrant Technology & Computers 13 PhpMyAdmin
  • 14. MySQL & PHP, presented by Vibrant Technology & Computers 14 MySQL + PHP Need a web server that connects to a local or remote Database? No problem! Host most likely “localhost”. To perform SQL commands, try this php function... $sql = mysql_query(“SELECT * FROM myTable); Just like with Java and its JDBC. There is a way to iterate through the resulting bag.
  • 15. MySQL & PHP, presented by Vibrant Technology & Computers 15 List all query results Ex.
  • 16. MySQL & PHP, presented by Vibrant Technology & Computers 16 PHP Control Structure Ex. PHP is much like C, Java, or Javascript in some ways. This will print 0123456789
  • 17. MySQL & PHP, presented by Vibrant Technology & Computers 17 Form Post Ex. (1 of 2) • Test.php is purely HTML. • Form's POST action sends the object names to PHP file. • PHP file extracts them with array $_POST[].
  • 18. MySQL & PHP, presented by Vibrant Technology & Computers 18 Form Post Ex. (2 of 2)
  • 19. MySQL & PHP, presented by Vibrant Technology & Computers 19 How do I get PHP or MySQL? Mysql.com (100 MB) php.net (for reference) Some web server, like Apache or Wampserver will work. For the examples, I used Wampserver (wampserver.com) (16 MB) 1. Installed MySQL 2. created some new tables with mysql 3. installed Wampserver 4. make .PHP files and put them in the www folder 5. Go to http://localhost/my.php 6. test your code.
  • 20. MySQL & PHP, presented by Vibrant Technology & Computers 20 MySQL-PHP Conclusion âž” MySQL is open-source and PHP is open-library. âž” MySQL and PHP work well together. âž” Free. Fairly simple and familiar to program with. âž” MySQL is fast enough, but PHP is fairly slow. âž” Many real-world applications on-line or even in a local network. âž” If you are sick of MySQL command line, go get a web server with PhpMyAdmin.
  • 21. MySQL & PHP, presented by Vibrant Technology & Computers 21 References 1. http://www.mysql.com 2. http://www.php.net/mysql 3. http://www.wampserver.com 4. http://en.wikipedia.org/wiki/SQL 5. http://en.wikipedia.org/wiki/Mysql 6. http://en.wikipedia.org/wiki/Php
  • 22. Thank You… MySQL & PHP, presented by Vibrant Technology & Computers 22