SlideShare a Scribd company logo
1 of 20
© 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

What's hot

Create dynamic sites with PHP & MySQL
Create dynamic sites with PHP & MySQLCreate dynamic sites with PHP & MySQL
Create dynamic sites with PHP & MySQLkangaro10a
 
Cliw - extension development
Cliw -  extension developmentCliw -  extension development
Cliw - extension developmentvicccuu
 
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...Nguyen Duc Phu
 
Drupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case StudyDrupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case Studyhernanibf
 
WordPress 3.0 MultiSite Features
WordPress 3.0 MultiSite FeaturesWordPress 3.0 MultiSite Features
WordPress 3.0 MultiSite FeaturesPete Mall
 
WordCamp Finland 2015 - WordPress Security
WordCamp Finland 2015 - WordPress SecurityWordCamp Finland 2015 - WordPress Security
WordCamp Finland 2015 - WordPress SecurityTiia Rantanen
 
Apache Web server Complete Guide
Apache Web server Complete GuideApache Web server Complete Guide
Apache Web server Complete Guidewebhostingguy
 
Complete Wordpress Security By CHETAN SONI - Cyber Security Expert
Complete Wordpress Security By CHETAN SONI - Cyber Security ExpertComplete Wordpress Security By CHETAN SONI - Cyber Security Expert
Complete Wordpress Security By CHETAN SONI - Cyber Security ExpertChetan Soni
 
Apache2 BootCamp : Getting Started With Apache
Apache2 BootCamp : Getting Started With ApacheApache2 BootCamp : Getting Started With Apache
Apache2 BootCamp : Getting Started With ApacheWildan Maulana
 
Installation of OpenBiblio on Windows XP using EasyPHP
Installation of OpenBiblio on Windows XP using EasyPHPInstallation of OpenBiblio on Windows XP using EasyPHP
Installation of OpenBiblio on Windows XP using EasyPHPRupesh Kumar
 
Introduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, TerminologiesIntroduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, TerminologiesGerald Villorente
 

What's hot (20)

Create dynamic sites with PHP & MySQL
Create dynamic sites with PHP & MySQLCreate dynamic sites with PHP & MySQL
Create dynamic sites with PHP & MySQL
 
Cliw - extension development
Cliw -  extension developmentCliw -  extension development
Cliw - extension development
 
Php myadmin
Php myadminPhp myadmin
Php myadmin
 
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
Hanoi php day 2008 - 05. nguyen hai nhat huy - building-restful-web-service-w...
 
Drupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case StudyDrupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case Study
 
Security in php
Security in phpSecurity in php
Security in php
 
Doc
DocDoc
Doc
 
Php File Upload
Php File UploadPhp File Upload
Php File Upload
 
File Upload
File UploadFile Upload
File Upload
 
WordPress 3.0 MultiSite Features
WordPress 3.0 MultiSite FeaturesWordPress 3.0 MultiSite Features
WordPress 3.0 MultiSite Features
 
veracruz
veracruzveracruz
veracruz
 
WordCamp Finland 2015 - WordPress Security
WordCamp Finland 2015 - WordPress SecurityWordCamp Finland 2015 - WordPress Security
WordCamp Finland 2015 - WordPress Security
 
Apache Web server Complete Guide
Apache Web server Complete GuideApache Web server Complete Guide
Apache Web server Complete Guide
 
Complete Wordpress Security By CHETAN SONI - Cyber Security Expert
Complete Wordpress Security By CHETAN SONI - Cyber Security ExpertComplete Wordpress Security By CHETAN SONI - Cyber Security Expert
Complete Wordpress Security By CHETAN SONI - Cyber Security Expert
 
Local Drupal MultiSite Set-up
Local Drupal MultiSite Set-upLocal Drupal MultiSite Set-up
Local Drupal MultiSite Set-up
 
Apache2 BootCamp : Getting Started With Apache
Apache2 BootCamp : Getting Started With ApacheApache2 BootCamp : Getting Started With Apache
Apache2 BootCamp : Getting Started With Apache
 
puissance-2roue
puissance-2rouepuissance-2roue
puissance-2roue
 
Installation of OpenBiblio on Windows XP using EasyPHP
Installation of OpenBiblio on Windows XP using EasyPHPInstallation of OpenBiblio on Windows XP using EasyPHP
Installation of OpenBiblio on Windows XP using EasyPHP
 
PHP
PHP PHP
PHP
 
Introduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, TerminologiesIntroduction to Drupal - Installation, Anatomy, Terminologies
Introduction to Drupal - Installation, Anatomy, Terminologies
 

Similar to Rits Brown Bag - PHP & PHPMyAdmin

Php &amp; my sql - how do pdo, mysq-li, and x devapi do what they do
Php &amp; my sql  - how do pdo, mysq-li, and x devapi do what they doPhp &amp; my sql  - how do pdo, mysq-li, and x devapi do what they do
Php &amp; my sql - how do pdo, mysq-li, and x devapi do what they doDave Stokes
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to phpjgarifuna
 
PHP and MySQL : Server Side Scripting For Web Development
PHP and MySQL : Server Side Scripting For Web DevelopmentPHP and MySQL : Server Side Scripting For Web Development
PHP and MySQL : Server Side Scripting For Web DevelopmentEdureka!
 
Php basic for vit university
Php basic for vit universityPhp basic for vit university
Php basic for vit universityMandakini Kumari
 
HackU PHP and Node.js
HackU PHP and Node.jsHackU PHP and Node.js
HackU PHP and Node.jssouridatta
 
Php Interview Questions
Php Interview QuestionsPhp Interview Questions
Php Interview QuestionsUmeshSingh159
 
Php Applications with Oracle by Kuassi Mensah
Php Applications with Oracle by Kuassi MensahPhp Applications with Oracle by Kuassi Mensah
Php Applications with Oracle by Kuassi MensahPHP Barcelona Conference
 
PHP Unit-1 Introduction to PHP
PHP Unit-1 Introduction to PHPPHP Unit-1 Introduction to PHP
PHP Unit-1 Introduction to PHPLariya Minhaz
 
Amp and higher computing science
Amp and higher computing scienceAmp and higher computing science
Amp and higher computing scienceCharlie Love
 

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

Php &amp; my sql - how do pdo, mysq-li, and x devapi do what they do
Php &amp; my sql  - how do pdo, mysq-li, and x devapi do what they doPhp &amp; my sql  - how do pdo, mysq-li, and x devapi do what they do
Php &amp; my sql - how do pdo, mysq-li, and x devapi do what they do
 
Php with mysql ppt
Php with mysql pptPhp with mysql ppt
Php with mysql ppt
 
Php talk
Php talkPhp talk
Php talk
 
PHP and MySQL.ppt
PHP and MySQL.pptPHP and MySQL.ppt
PHP and MySQL.ppt
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Current state-of-php
Current state-of-phpCurrent state-of-php
Current state-of-php
 
PHP and MySQL : Server Side Scripting For Web Development
PHP and MySQL : Server Side Scripting For Web DevelopmentPHP and MySQL : Server Side Scripting For Web Development
PHP and MySQL : Server Side Scripting For Web Development
 
Php basic for vit university
Php basic for vit universityPhp basic for vit university
Php basic for vit university
 
HackU PHP and Node.js
HackU PHP and Node.jsHackU PHP and Node.js
HackU PHP and Node.js
 
New PHP Exploitation Techniques
New PHP Exploitation TechniquesNew PHP Exploitation Techniques
New PHP Exploitation Techniques
 
Php Interview Questions
Php Interview QuestionsPhp Interview Questions
Php Interview Questions
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
Php Applications with Oracle by Kuassi Mensah
Php Applications with Oracle by Kuassi MensahPhp Applications with Oracle by Kuassi Mensah
Php Applications with Oracle by Kuassi Mensah
 
PHP Unit-1 Introduction to PHP
PHP Unit-1 Introduction to PHPPHP Unit-1 Introduction to PHP
PHP Unit-1 Introduction to PHP
 
Amp and higher computing science
Amp and higher computing scienceAmp and higher computing science
Amp and higher computing science
 
Php intro
Php introPhp intro
Php intro
 
Php intro
Php introPhp intro
Php intro
 
Php intro
Php introPhp intro
Php intro
 
wamp.ppt
wamp.pptwamp.ppt
wamp.ppt
 

More from Right IT Services

Rits Brown Bag - React Native and Salesforce
Rits Brown Bag - React Native and SalesforceRits Brown Bag - React Native and Salesforce
Rits Brown Bag - React Native and SalesforceRight IT Services
 
Rits Brown Bag - Conga Composer
Rits Brown Bag - Conga ComposerRits Brown Bag - Conga Composer
Rits Brown Bag - Conga ComposerRight IT Services
 
Rits Brown Bag - Extending and Integrating in Microsoft Dynamics CRM
Rits Brown Bag - Extending and Integrating in Microsoft Dynamics CRMRits Brown Bag - Extending and Integrating in Microsoft Dynamics CRM
Rits Brown Bag - Extending and Integrating in Microsoft Dynamics CRMRight IT Services
 
Rits Brown Bag - Environment MS Dynamics CRM
Rits Brown Bag -  Environment MS Dynamics CRMRits Brown Bag -  Environment MS Dynamics CRM
Rits Brown Bag - Environment MS Dynamics CRMRight IT Services
 
Rits Brown Bag - Google AdWords Basics
Rits Brown Bag - Google AdWords BasicsRits Brown Bag - Google AdWords Basics
Rits Brown Bag - Google AdWords BasicsRight IT Services
 
Salesforce.com Continuous Integration
Salesforce.com Continuous IntegrationSalesforce.com Continuous Integration
Salesforce.com Continuous IntegrationRight IT Services
 
Rits Brown Bag - SharePoint 2016
Rits Brown Bag - SharePoint 2016Rits Brown Bag - SharePoint 2016
Rits Brown Bag - SharePoint 2016Right IT Services
 
Rits Brown Bag - Salesforce Social Studio
Rits Brown Bag - Salesforce Social StudioRits Brown Bag - Salesforce Social Studio
Rits Brown Bag - Salesforce Social StudioRight IT Services
 
Rits Brown Bag - Introduction to SharePoint
Rits Brown Bag - Introduction to SharePointRits Brown Bag - Introduction to SharePoint
Rits Brown Bag - Introduction to SharePointRight IT Services
 
Workbook for Lightning Developers
Workbook for Lightning DevelopersWorkbook for Lightning Developers
Workbook for Lightning DevelopersRight IT Services
 
Rits Brown Bag - Surveys and Polls Techniques
Rits Brown Bag - Surveys and Polls TechniquesRits Brown Bag - Surveys and Polls Techniques
Rits Brown Bag - Surveys and Polls TechniquesRight IT Services
 
Rits Brown Bag - Salesforce Lightning External Connection
Rits Brown Bag - Salesforce Lightning External ConnectionRits Brown Bag - Salesforce Lightning External Connection
Rits Brown Bag - Salesforce Lightning External ConnectionRight IT Services
 
Rits Brown Bag - Anatomy of a Mobile App
Rits Brown Bag - Anatomy of a Mobile AppRits Brown Bag - Anatomy of a Mobile App
Rits Brown Bag - Anatomy of a Mobile AppRight IT Services
 
Rits Brown Bag - Salesforce Duplicate Management
Rits Brown Bag - Salesforce Duplicate ManagementRits Brown Bag - Salesforce Duplicate Management
Rits Brown Bag - Salesforce Duplicate ManagementRight IT Services
 
Rits Brown Bag - Salesforce AppExchange
Rits Brown Bag - Salesforce AppExchangeRits Brown Bag - Salesforce AppExchange
Rits Brown Bag - Salesforce AppExchangeRight IT Services
 
Rits Brown Bag - Salesforce Lightning
Rits Brown Bag - Salesforce LightningRits Brown Bag - Salesforce Lightning
Rits Brown Bag - Salesforce LightningRight IT Services
 

More from Right IT Services (19)

Rits Brown Bag - React Native and Salesforce
Rits Brown Bag - React Native and SalesforceRits Brown Bag - React Native and Salesforce
Rits Brown Bag - React Native and Salesforce
 
Rits Brown Bag - Conga Composer
Rits Brown Bag - Conga ComposerRits Brown Bag - Conga Composer
Rits Brown Bag - Conga Composer
 
Rits Brown Bag - TypeScript
Rits Brown Bag - TypeScriptRits Brown Bag - TypeScript
Rits Brown Bag - TypeScript
 
Rits Brown Bag - Extending and Integrating in Microsoft Dynamics CRM
Rits Brown Bag - Extending and Integrating in Microsoft Dynamics CRMRits Brown Bag - Extending and Integrating in Microsoft Dynamics CRM
Rits Brown Bag - Extending and Integrating in Microsoft Dynamics CRM
 
Rits Brown Bag - Environment MS Dynamics CRM
Rits Brown Bag -  Environment MS Dynamics CRMRits Brown Bag -  Environment MS Dynamics CRM
Rits Brown Bag - Environment MS Dynamics CRM
 
Rits Brown Bag - Google AdWords Basics
Rits Brown Bag - Google AdWords BasicsRits Brown Bag - Google AdWords Basics
Rits Brown Bag - Google AdWords Basics
 
Rits Brown Bag - Office 365
Rits Brown Bag - Office 365Rits Brown Bag - Office 365
Rits Brown Bag - Office 365
 
Salesforce.com Continuous Integration
Salesforce.com Continuous IntegrationSalesforce.com Continuous Integration
Salesforce.com Continuous Integration
 
Rits Brown Bag - SharePoint 2016
Rits Brown Bag - SharePoint 2016Rits Brown Bag - SharePoint 2016
Rits Brown Bag - SharePoint 2016
 
Rits Brown Bag - vtiger
Rits Brown Bag - vtigerRits Brown Bag - vtiger
Rits Brown Bag - vtiger
 
Rits Brown Bag - Salesforce Social Studio
Rits Brown Bag - Salesforce Social StudioRits Brown Bag - Salesforce Social Studio
Rits Brown Bag - Salesforce Social Studio
 
Rits Brown Bag - Introduction to SharePoint
Rits Brown Bag - Introduction to SharePointRits Brown Bag - Introduction to SharePoint
Rits Brown Bag - Introduction to SharePoint
 
Workbook for Lightning Developers
Workbook for Lightning DevelopersWorkbook for Lightning Developers
Workbook for Lightning Developers
 
Rits Brown Bag - Surveys and Polls Techniques
Rits Brown Bag - Surveys and Polls TechniquesRits Brown Bag - Surveys and Polls Techniques
Rits Brown Bag - Surveys and Polls Techniques
 
Rits Brown Bag - Salesforce Lightning External Connection
Rits Brown Bag - Salesforce Lightning External ConnectionRits Brown Bag - Salesforce Lightning External Connection
Rits Brown Bag - Salesforce Lightning External Connection
 
Rits Brown Bag - Anatomy of a Mobile App
Rits Brown Bag - Anatomy of a Mobile AppRits Brown Bag - Anatomy of a Mobile App
Rits Brown Bag - Anatomy of a Mobile App
 
Rits Brown Bag - Salesforce Duplicate Management
Rits Brown Bag - Salesforce Duplicate ManagementRits Brown Bag - Salesforce Duplicate Management
Rits Brown Bag - Salesforce Duplicate Management
 
Rits Brown Bag - Salesforce AppExchange
Rits Brown Bag - Salesforce AppExchangeRits Brown Bag - Salesforce AppExchange
Rits Brown Bag - Salesforce AppExchange
 
Rits Brown Bag - Salesforce Lightning
Rits Brown Bag - Salesforce LightningRits Brown Bag - Salesforce Lightning
Rits Brown Bag - Salesforce Lightning
 

Recently uploaded

Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 

Recently uploaded (20)

Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 

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