SlideShare a Scribd company logo
© 2016, Right IT Services. All rights reserved
PHP & PHPMyAdmin
Tuesday, 10th May 2016
PHPMyAdmin
3
PHPMyAdmin
PHP & PHPMyAdmin
Is a database system used on the web
Is a database system that runs on a server
Is very fast, reliable, and easy to use
Uses standard SQL
Is developed, distributed, and supported by Oracle Corporation
Is named after co-founder Monty Widenius's daughter: My
4
PHPMyAdmin – Main Menu
PHP & PHPMyAdmin
5
PHPMyAdmin – Table
PHP & PHPMyAdmin
PHP (Hypertext Preprocessor)
Agenda
7
Server
PHP
Page “Hello World”
Connection to Database
Connection to Database(Class)
Extends Class
Insert Data
Display Data
PHP & PHPMyAdmin
8
PHP - Server
PHP & PHPMyAdmin
To work with PHP you have to install a webserver
Can use XAMPP or LAMP, LAMP is for Linux SO but XAMPP works in any SO, X means Cross-Platform
XAMPP can run the following:
Apache (need it to run php)
MySQL (Database)
FileZilla
Mercury
Tomcat
9
•PHP
PHP & PHPMyAdmin
PHP is a Server Side Language
PHP is an acronym for "Hypertext Preprocessor"
Languages you should have a basic understanding
HTML
CSS
JavaScript
Why PHP?
PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
PHP is compatible with almost all servers used today (Apache, IIS, etc.)
PHP supports a wide range of databases
PHP is free.
10
Page “Hello World”
PHP & PHPMyAdmin
index.php
<!DOCTYPE html>
<html>
<body>
<h1>My first PHP page</h1>
</body>
</html>
index.php
<!DOCTYPE html>
<html>
<body>
<h1>My first PHP page</h1>
<?php
echo "Hello World!";
?>
</body>
</html>
11
Connection to Database
PHP & PHPMyAdmin
index.php
<!DOCTYPE html>
<html>
<body>
<h1>My first PHP page</h1>
<?php
$servername = "localhost";
$username = "";
$password = "";
$dbname = "test";
// Create connection
$conn = new mysqli($servername, $username, $password,$dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully to database";
?>
</body>
</html>
12
Connection to Database(Class)
PHP & PHPMyAdmin
index.php
<!DOCTYPE html>
<html>
<body>
<h1>My first PHP page</h1>
<?php
require_once 'base_dados.php';
$bd = new base_dados();
echo "Hello World!";
echo "<br><br>";
echo $bd->login();
?>
</body>
</html>
base_dados.php
<?php
Class base_dados {
function login(){
$servername = "localhost";
$username = "";
$password = "";
$dbname = "test";
// Create connection
$conn = new mysqli($servername, $username, $password,$dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
return "Connected successfully to database(class)";
}
}
?>
13
Connection to Database(Class)
PHP & PHPMyAdmin
14
Extends Class
PHP & PHPMyAdmin
index.php
<!DOCTYPE html>
<html>
<body>
<h1>My first PHP page</h1>
<?php
require_once 'base_dados.php';
$bd = new base_dados();
echo "Hello World! (extend)";
echo $bd->criar_linhas(2);
echo $bd->login();
?>
</body>
</html>
base_dados.php
<?php
require_once('ficheiro.php');
Class base_dados extends classe_externa {
------------
}
ficheiro.php
<?php
Class classe_externa {
function criar_linhas($numero) {
$retorno = '';
for ($i=0;$i<$numero;$i++) {
$retorno .= "<br>";
}
return $retorno;
}
}
?>
15
Extends Class
PHP & PHPMyAdmin
16
Insert Data
PHP & PHPMyAdmin
index.php
<!DOCTYPE html>
<html>
<body>
<h1>My first PHP page</h1>
<?php
require_once 'base_dados.php';
$bd = new base_dados();
echo "Hello World!";
echo $bd->criar_linhas(2);
echo $bd->inserir_registo();
?>
</body>
</html>
base_dados.php
<?php
require_once('ficheiro.php');
Class base_dados extends classe_externa {
var $conn;
function login(){
function inserir_registo() {
$this->login();
$data= date('Y-m-d');
$sql = "INSERT INTO tabela_teste (ID, Nome, Numero, Data_Registo) VALUES (NULL, 'teste insercao', 1,
'$data')";
if ($this->conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $this->conn->error;
}
}
}
?>
17
Insert Data
PHP & PHPMyAdmin
18
Display Data
PHP & PHPMyAdmin
index.php
<!DOCTYPE html>
<html>
<body>
<h1>My first PHP page</h1>
<?php
require_once 'base_dados.php';
$bd = new base_dados();
echo "Hello World!";
echo $bd->criar_linhas(2);
echo $bd->selecionar();
?>
</body>
</html>
base_dados.php
<?php
require_once('ficheiro.php');
Class base_dados extends classe_externa {
function login(){
function inserir_registo {
function selecionar() {
$this->login();
$retorno = '';
$sql = "SELECT id, nome, numero, data_registo FROM tabela_teste limit 5";
$result = $this->conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
$retorno .= "ID: " . $row["id"] . "<br> Nome: " . $row["nome"]. "<br>";
$retorno .= "Numero " . $row["numero"]. "<br> Data registo " . $row["data_registo"]. "<br>";
$retorno .= $this->criar_linhas(1);
}
} else {
$retorno = "0 results";
}
return $retorno;
}
}
19
Display Data
PHP & PHPMyAdmin
WHEN YOU HAVE TO DO IT, DO IT RIGHT
© 2016, Right IT Services. All rights reserved Rua Odette Saint Maurice Lote 3B | Edifício L | Escritório A | Piso -1 | 1700-097 Lisboa | Portugal | +351 218 232 261
Technical Architect | Joaquim Nuno Mendes
PHP & PHPMyAdmin
Tuesday, 10th May 2016

More Related Content

PPT
Drupalxamppxp 1229687989691791 1
PPTX
Lamp introduction in Fedora
ODP
PHP BASIC PRESENTATION
PPT
Mambo (2006) Presentation on CMS
PPT
Serving Moodle Presentation
PPTX
Php basics
PPTX
PHP Hypertext Preprocessor
PPTX
PHP presentation - Com 585
Drupalxamppxp 1229687989691791 1
Lamp introduction in Fedora
PHP BASIC PRESENTATION
Mambo (2006) Presentation on CMS
Serving Moodle Presentation
Php basics
PHP Hypertext Preprocessor
PHP presentation - Com 585

What's hot (20)

PDF
Create dynamic sites with PHP & MySQL
PPTX
Cliw - extension development
PPT
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
PPT
Drupal Performance - SerBenfiquista.com Case Study
PDF
Security in php
PDF
Doc
ODP
Php File Upload
PPT
File Upload
PPT
WordPress 3.0 MultiSite Features
PDF
veracruz
PDF
WordCamp Finland 2015 - WordPress Security
PDF
Apache Web server Complete Guide
PDF
Complete Wordpress Security By CHETAN SONI - Cyber Security Expert
PPT
Local Drupal MultiSite Set-up
PDF
Apache2 BootCamp : Getting Started With Apache
PDF
puissance-2roue
PPT
Installation of OpenBiblio on Windows XP using EasyPHP
PPT
PDF
Introduction to Drupal - Installation, Anatomy, Terminologies
Create dynamic sites with PHP & MySQL
Cliw - extension development
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
Drupal Performance - SerBenfiquista.com Case Study
Security in php
Doc
Php File Upload
File Upload
WordPress 3.0 MultiSite Features
veracruz
WordCamp Finland 2015 - WordPress Security
Apache Web server Complete Guide
Complete Wordpress Security By CHETAN SONI - Cyber Security Expert
Local Drupal MultiSite Set-up
Apache2 BootCamp : Getting Started With Apache
puissance-2roue
Installation of OpenBiblio on Windows XP using EasyPHP
Introduction to Drupal - Installation, Anatomy, Terminologies
Ad

Similar to Rits Brown Bag - PHP & PHPMyAdmin (20)

ODP
PPTX
Connecting to my sql using PHP
PPTX
Php with mysql ppt
PPTX
PHP DATABASE MANAGEMENT.pptx
PPTX
MySQL with PHP
PPTX
Lecture1 introduction by okello erick
PDF
Php summary
PPTX
PHP-MySQL Database Connectivity Using XAMPP Server
PDF
Php my sql programing - brochure
PPT
Php classes in mumbai
PPT
PHP and MySQL
PPTX
SRMS 5th Sem Minor project.pptx
PPTX
Php reports sumit
PPTX
PHP tutorials , php tutorials for beginners , tutorials for php
PDF
P mysql training in bangalore
PDF
PHP & mySQL Training in Bangalore at myTectra
PPTX
introduction to backend with php 8.X - slide.pptx
PDF
Php 2
Connecting to my sql using PHP
Php with mysql ppt
PHP DATABASE MANAGEMENT.pptx
MySQL with PHP
Lecture1 introduction by okello erick
Php summary
PHP-MySQL Database Connectivity Using XAMPP Server
Php my sql programing - brochure
Php classes in mumbai
PHP and MySQL
SRMS 5th Sem Minor project.pptx
Php reports sumit
PHP tutorials , php tutorials for beginners , tutorials for php
P mysql training in bangalore
PHP & mySQL Training in Bangalore at myTectra
introduction to backend with php 8.X - slide.pptx
Php 2
Ad

More from Right IT Services (19)

PDF
Rits Brown Bag - React Native and Salesforce
PDF
Rits Brown Bag - Conga Composer
PPTX
Rits Brown Bag - TypeScript
PPTX
Rits Brown Bag - Extending and Integrating in Microsoft Dynamics CRM
PPTX
Rits Brown Bag - Environment MS Dynamics CRM
PPTX
Rits Brown Bag - Google AdWords Basics
PPTX
Rits Brown Bag - Office 365
PPTX
Salesforce.com Continuous Integration
PDF
Rits Brown Bag - SharePoint 2016
PDF
Rits Brown Bag - vtiger
PDF
Rits Brown Bag - Salesforce Social Studio
PDF
Rits Brown Bag - Introduction to SharePoint
PDF
Workbook for Lightning Developers
PDF
Rits Brown Bag - Surveys and Polls Techniques
PDF
Rits Brown Bag - Salesforce Lightning External Connection
PDF
Rits Brown Bag - Anatomy of a Mobile App
PDF
Rits Brown Bag - Salesforce Duplicate Management
PDF
Rits Brown Bag - Salesforce AppExchange
PPTX
Rits Brown Bag - Salesforce Lightning
Rits Brown Bag - React Native and Salesforce
Rits Brown Bag - Conga Composer
Rits Brown Bag - TypeScript
Rits Brown Bag - Extending and Integrating in Microsoft Dynamics CRM
Rits Brown Bag - Environment MS Dynamics CRM
Rits Brown Bag - Google AdWords Basics
Rits Brown Bag - Office 365
Salesforce.com Continuous Integration
Rits Brown Bag - SharePoint 2016
Rits Brown Bag - vtiger
Rits Brown Bag - Salesforce Social Studio
Rits Brown Bag - Introduction to SharePoint
Workbook for Lightning Developers
Rits Brown Bag - Surveys and Polls Techniques
Rits Brown Bag - Salesforce Lightning External Connection
Rits Brown Bag - Anatomy of a Mobile App
Rits Brown Bag - Salesforce Duplicate Management
Rits Brown Bag - Salesforce AppExchange
Rits Brown Bag - Salesforce Lightning

Recently uploaded (20)

PDF
KodekX | Application Modernization Development
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Spectroscopy.pptx food analysis technology
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPT
Teaching material agriculture food technology
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
KodekX | Application Modernization Development
Review of recent advances in non-invasive hemoglobin estimation
sap open course for s4hana steps from ECC to s4
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Dropbox Q2 2025 Financial Results & Investor Presentation
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Spectroscopy.pptx food analysis technology
Reach Out and Touch Someone: Haptics and Empathic Computing
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Encapsulation_ Review paper, used for researhc scholars
Teaching material agriculture food technology
Diabetes mellitus diagnosis method based random forest with bat algorithm
Chapter 3 Spatial Domain Image Processing.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...

Rits Brown Bag - PHP & PHPMyAdmin

  • 1. © 2016, Right IT Services. All rights reserved PHP & PHPMyAdmin Tuesday, 10th May 2016
  • 3. 3 PHPMyAdmin PHP & PHPMyAdmin Is a database system used on the web Is a database system that runs on a server Is very fast, reliable, and easy to use Uses standard SQL Is developed, distributed, and supported by Oracle Corporation Is named after co-founder Monty Widenius's daughter: My
  • 4. 4 PHPMyAdmin – Main Menu PHP & PHPMyAdmin
  • 7. Agenda 7 Server PHP Page “Hello World” Connection to Database Connection to Database(Class) Extends Class Insert Data Display Data PHP & PHPMyAdmin
  • 8. 8 PHP - Server PHP & PHPMyAdmin To work with PHP you have to install a webserver Can use XAMPP or LAMP, LAMP is for Linux SO but XAMPP works in any SO, X means Cross-Platform XAMPP can run the following: Apache (need it to run php) MySQL (Database) FileZilla Mercury Tomcat
  • 9. 9 •PHP PHP & PHPMyAdmin PHP is a Server Side Language PHP is an acronym for "Hypertext Preprocessor" Languages you should have a basic understanding HTML CSS JavaScript Why PHP? PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.) PHP is compatible with almost all servers used today (Apache, IIS, etc.) PHP supports a wide range of databases PHP is free.
  • 10. 10 Page “Hello World” PHP & PHPMyAdmin index.php <!DOCTYPE html> <html> <body> <h1>My first PHP page</h1> </body> </html> index.php <!DOCTYPE html> <html> <body> <h1>My first PHP page</h1> <?php echo "Hello World!"; ?> </body> </html>
  • 11. 11 Connection to Database PHP & PHPMyAdmin index.php <!DOCTYPE html> <html> <body> <h1>My first PHP page</h1> <?php $servername = "localhost"; $username = ""; $password = ""; $dbname = "test"; // Create connection $conn = new mysqli($servername, $username, $password,$dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } echo "Connected successfully to database"; ?> </body> </html>
  • 12. 12 Connection to Database(Class) PHP & PHPMyAdmin index.php <!DOCTYPE html> <html> <body> <h1>My first PHP page</h1> <?php require_once 'base_dados.php'; $bd = new base_dados(); echo "Hello World!"; echo "<br><br>"; echo $bd->login(); ?> </body> </html> base_dados.php <?php Class base_dados { function login(){ $servername = "localhost"; $username = ""; $password = ""; $dbname = "test"; // Create connection $conn = new mysqli($servername, $username, $password,$dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } return "Connected successfully to database(class)"; } } ?>
  • 14. 14 Extends Class PHP & PHPMyAdmin index.php <!DOCTYPE html> <html> <body> <h1>My first PHP page</h1> <?php require_once 'base_dados.php'; $bd = new base_dados(); echo "Hello World! (extend)"; echo $bd->criar_linhas(2); echo $bd->login(); ?> </body> </html> base_dados.php <?php require_once('ficheiro.php'); Class base_dados extends classe_externa { ------------ } ficheiro.php <?php Class classe_externa { function criar_linhas($numero) { $retorno = ''; for ($i=0;$i<$numero;$i++) { $retorno .= "<br>"; } return $retorno; } } ?>
  • 16. 16 Insert Data PHP & PHPMyAdmin index.php <!DOCTYPE html> <html> <body> <h1>My first PHP page</h1> <?php require_once 'base_dados.php'; $bd = new base_dados(); echo "Hello World!"; echo $bd->criar_linhas(2); echo $bd->inserir_registo(); ?> </body> </html> base_dados.php <?php require_once('ficheiro.php'); Class base_dados extends classe_externa { var $conn; function login(){ function inserir_registo() { $this->login(); $data= date('Y-m-d'); $sql = "INSERT INTO tabela_teste (ID, Nome, Numero, Data_Registo) VALUES (NULL, 'teste insercao', 1, '$data')"; if ($this->conn->query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . $this->conn->error; } } } ?>
  • 17. 17 Insert Data PHP & PHPMyAdmin
  • 18. 18 Display Data PHP & PHPMyAdmin index.php <!DOCTYPE html> <html> <body> <h1>My first PHP page</h1> <?php require_once 'base_dados.php'; $bd = new base_dados(); echo "Hello World!"; echo $bd->criar_linhas(2); echo $bd->selecionar(); ?> </body> </html> base_dados.php <?php require_once('ficheiro.php'); Class base_dados extends classe_externa { function login(){ function inserir_registo { function selecionar() { $this->login(); $retorno = ''; $sql = "SELECT id, nome, numero, data_registo FROM tabela_teste limit 5"; $result = $this->conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { $retorno .= "ID: " . $row["id"] . "<br> Nome: " . $row["nome"]. "<br>"; $retorno .= "Numero " . $row["numero"]. "<br> Data registo " . $row["data_registo"]. "<br>"; $retorno .= $this->criar_linhas(1); } } else { $retorno = "0 results"; } return $retorno; } }
  • 19. 19 Display Data PHP & PHPMyAdmin
  • 20. WHEN YOU HAVE TO DO IT, DO IT RIGHT © 2016, Right IT Services. All rights reserved Rua Odette Saint Maurice Lote 3B | Edifício L | Escritório A | Piso -1 | 1700-097 Lisboa | Portugal | +351 218 232 261 Technical Architect | Joaquim Nuno Mendes PHP & PHPMyAdmin Tuesday, 10th May 2016