SlideShare uma empresa Scribd logo
1 de 17
MySQL Record Operations
Jamshid Hashimi
Trainer, Cresco Solution
http://www.jamshidhashimi.com
jamshid@netlinks.af
@jamshidhashimi
ajamshidhashimi
Afghanistan Workforce
Development Program
Agenda
• MySQLi Introduction
• mysqli() Overview
• mysqli Methods and Properties
• INSERT, UPDATE & DELETE
• mysqli Prepared Statements
• Inserting, Updating and Deleting Records
• Managing Data
MySQLi Introduction
• MySQLi, often called MySQL Improved, has
several advantages over regular MySQL,
including support for prepared statements
(which helps prevent SQL injection, a common
security issue) and object-oriented code.
MySQLi Introduction
• The mysqli extension has a number of
benefits, the key enhancements over the
mysql extension being:
– Object-oriented interface
– Support for Prepared Statements
– Support for Multiple Statements
– Support for Transactions
– Enhanced debugging capabilities
– Embedded server support
MySQLi Introduction
• mysql_query() – Deprecated!
MySQLi
• mysqli_fetch_assoc (fetch_assoc())
– Fetch a result row as an associative array
/* fetch associative array */
while ($row = $result->fetch_assoc()) {
printf ("%s n", $row["Name”]);
}
MySQLi
• mysqli_fetch_array (fetch_array())
– Fetch a result row as an associative, a numeric
array, or both
– MYSQLI_NUM
– MYSQLI_ASSOC
– MYSQLI_BOTH
/* associative array */
$row = $result->fetch_array(MYSQLI_ASSOC);
printf ("%sn", $row["Name”]);
MySQLi
• mysqli_fetch_object (fetch_object())
– Returns the current row of a result set as an
object
/* fetch object array */
while ($obj = $result->fetch_object()) {
printf ("%s n", $obj->Name);
}
MySQLi
• Do we need to close the connection?
– Open connections (and similar resources) are
automatically destroyed at the end of script
execution. However, you should still close or free
all connections, result sets and statement handles
as soon as they are no longer required. This will
help return resources to PHP and MySQL faster.
INSERT
• The INSERT INTO statement is used to insert
new records in a table.
• Syntax:
INSERT INTO table_name (column1, column2,
column3,...)
VALUES (value1, value2, value3,...)
UPDATE
• The UPDATE statement is used to modify data
in a table.
• Syntax:
UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value
DELETE
• The DELETE statement is used to delete
records in a table.
• Syntax:
DELETE FROM table_name
WHERE some_column = some_value
Prepared Statements
• Prepared statements provide developers with
the ability to create queries that are more
secure, have better performance, and are
more convenient to write.
Prepared Statements
if($rs = $mysqli->prepare("SELECT first_name FROM actor
WHERE first_name = ?")){
//binding parameteres
$rs->bind_param("s",$name);
$name = "BON";
//Execute it
$rs->execute();
//Bind results
$rs->bind_result($name);
//Fetch records
$rs->fetch();
printf("%s", $name);
$rs->close();
}else{
echo $mysqli->error;
}
$mysqli->close();
Managing Data
DEMO
QUESTIONS?

Mais conteúdo relacionado

Mais procurados

MySQL training in Bangalore | Best MySQL Course in Bangalore
MySQL training in Bangalore | Best MySQL Course in BangaloreMySQL training in Bangalore | Best MySQL Course in Bangalore
MySQL training in Bangalore | Best MySQL Course in BangaloreTIB Academy
 
android sqlite
android sqliteandroid sqlite
android sqliteDeepa Rani
 
Alasql fast JavaScript in-memory SQL database
Alasql fast JavaScript in-memory SQL databaseAlasql fast JavaScript in-memory SQL database
Alasql fast JavaScript in-memory SQL databaseAndrey Gershun
 
Sqlite
SqliteSqlite
SqliteKumar
 
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitMySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitDave Stokes
 
Fosdem2014 MariaDB CONNECT Storage Engine
Fosdem2014 MariaDB CONNECT Storage EngineFosdem2014 MariaDB CONNECT Storage Engine
Fosdem2014 MariaDB CONNECT Storage EngineSerge Frezefond
 
Android Training (Storing data using SQLite)
Android Training (Storing data using SQLite)Android Training (Storing data using SQLite)
Android Training (Storing data using SQLite)Khaled Anaqwa
 
SQL and NoSQL Better Together in Alasql
SQL and NoSQL Better Together in AlasqlSQL and NoSQL Better Together in Alasql
SQL and NoSQL Better Together in AlasqlAndrey Gershun
 
How to Analyze and Tune MySQL Queries for Better Performance
How to Analyze and Tune MySQL Queries for Better PerformanceHow to Analyze and Tune MySQL Queries for Better Performance
How to Analyze and Tune MySQL Queries for Better Performanceoysteing
 
Ten Reasons Why You Should Prefer PostgreSQL to MySQL
Ten Reasons Why You Should Prefer PostgreSQL to MySQLTen Reasons Why You Should Prefer PostgreSQL to MySQL
Ten Reasons Why You Should Prefer PostgreSQL to MySQLanandology
 
How to search extracted data
How to search extracted dataHow to search extracted data
How to search extracted dataJavier Collado
 

Mais procurados (15)

MySQL HA Solutions (Recopilation)
MySQL HA Solutions (Recopilation)MySQL HA Solutions (Recopilation)
MySQL HA Solutions (Recopilation)
 
MySQL training in Bangalore | Best MySQL Course in Bangalore
MySQL training in Bangalore | Best MySQL Course in BangaloreMySQL training in Bangalore | Best MySQL Course in Bangalore
MySQL training in Bangalore | Best MySQL Course in Bangalore
 
android sqlite
android sqliteandroid sqlite
android sqlite
 
Alasql fast JavaScript in-memory SQL database
Alasql fast JavaScript in-memory SQL databaseAlasql fast JavaScript in-memory SQL database
Alasql fast JavaScript in-memory SQL database
 
Introduction to php database connectivity
Introduction to php  database connectivityIntroduction to php  database connectivity
Introduction to php database connectivity
 
Sqlite
SqliteSqlite
Sqlite
 
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitMySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
 
Fosdem2014 MariaDB CONNECT Storage Engine
Fosdem2014 MariaDB CONNECT Storage EngineFosdem2014 MariaDB CONNECT Storage Engine
Fosdem2014 MariaDB CONNECT Storage Engine
 
Hive jdbc
Hive jdbcHive jdbc
Hive jdbc
 
Android Training (Storing data using SQLite)
Android Training (Storing data using SQLite)Android Training (Storing data using SQLite)
Android Training (Storing data using SQLite)
 
MariaDB pres at LeMUG
MariaDB pres at LeMUGMariaDB pres at LeMUG
MariaDB pres at LeMUG
 
SQL and NoSQL Better Together in Alasql
SQL and NoSQL Better Together in AlasqlSQL and NoSQL Better Together in Alasql
SQL and NoSQL Better Together in Alasql
 
How to Analyze and Tune MySQL Queries for Better Performance
How to Analyze and Tune MySQL Queries for Better PerformanceHow to Analyze and Tune MySQL Queries for Better Performance
How to Analyze and Tune MySQL Queries for Better Performance
 
Ten Reasons Why You Should Prefer PostgreSQL to MySQL
Ten Reasons Why You Should Prefer PostgreSQL to MySQLTen Reasons Why You Should Prefer PostgreSQL to MySQL
Ten Reasons Why You Should Prefer PostgreSQL to MySQL
 
How to search extracted data
How to search extracted dataHow to search extracted data
How to search extracted data
 

Destaque

mySQL and Relational Databases
mySQL and Relational DatabasesmySQL and Relational Databases
mySQL and Relational Databaseswebhostingguy
 
Introduction to Active Record at MySQL Conference 2007
Introduction to Active Record at MySQL Conference 2007Introduction to Active Record at MySQL Conference 2007
Introduction to Active Record at MySQL Conference 2007Rabble .
 
Working with Databases and MySQL
Working with Databases and MySQLWorking with Databases and MySQL
Working with Databases and MySQLNicole Ryan
 
File organization
File organizationFile organization
File organizationGokul017
 
File organization 1
File organization 1File organization 1
File organization 1Rupali Rana
 
CBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL PresentationCBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL PresentationGuru Ji
 
MySQL partitions tutorial
MySQL partitions tutorialMySQL partitions tutorial
MySQL partitions tutorialGiuseppe Maxia
 
MySQL Atchitecture and Concepts
MySQL Atchitecture and ConceptsMySQL Atchitecture and Concepts
MySQL Atchitecture and ConceptsTuyen Vuong
 

Destaque (9)

Sending emails through PHP
Sending emails through PHPSending emails through PHP
Sending emails through PHP
 
mySQL and Relational Databases
mySQL and Relational DatabasesmySQL and Relational Databases
mySQL and Relational Databases
 
Introduction to Active Record at MySQL Conference 2007
Introduction to Active Record at MySQL Conference 2007Introduction to Active Record at MySQL Conference 2007
Introduction to Active Record at MySQL Conference 2007
 
Working with Databases and MySQL
Working with Databases and MySQLWorking with Databases and MySQL
Working with Databases and MySQL
 
File organization
File organizationFile organization
File organization
 
File organization 1
File organization 1File organization 1
File organization 1
 
CBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL PresentationCBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL Presentation
 
MySQL partitions tutorial
MySQL partitions tutorialMySQL partitions tutorial
MySQL partitions tutorial
 
MySQL Atchitecture and Concepts
MySQL Atchitecture and ConceptsMySQL Atchitecture and Concepts
MySQL Atchitecture and Concepts
 

Semelhante a MySQL Record Operations

MySQL developing Store Procedure
MySQL developing Store ProcedureMySQL developing Store Procedure
MySQL developing Store ProcedureMarco Tusa
 
Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8Ted Wennmark
 
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytWrushabhShirsat3
 
My sql technical reference manual
My sql technical reference manualMy sql technical reference manual
My sql technical reference manualMir Majid
 
Database Connectivity in PHP
Database Connectivity in PHPDatabase Connectivity in PHP
Database Connectivity in PHPTaha Malampatti
 
What's New In PostgreSQL 9.4
What's New In PostgreSQL 9.4What's New In PostgreSQL 9.4
What's New In PostgreSQL 9.4Pavan Deolasee
 
SQL PPT.pptx
SQL PPT.pptxSQL PPT.pptx
SQL PPT.pptxKulbir4
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slidesmetsarin
 
Trivadis TechEvent 2017 Oracle to My SQL Migration - Challenges by Robert Bia...
Trivadis TechEvent 2017 Oracle to My SQL Migration - Challenges by Robert Bia...Trivadis TechEvent 2017 Oracle to My SQL Migration - Challenges by Robert Bia...
Trivadis TechEvent 2017 Oracle to My SQL Migration - Challenges by Robert Bia...Trivadis
 
MySQL Reference Manual
MySQL Reference ManualMySQL Reference Manual
MySQL Reference Manualwebhostingguy
 
Learn PHP Lacture2
Learn PHP Lacture2Learn PHP Lacture2
Learn PHP Lacture2ADARSH BHATT
 

Semelhante a MySQL Record Operations (20)

PHP with MySQL
PHP with MySQLPHP with MySQL
PHP with MySQL
 
My sql1
My sql1My sql1
My sql1
 
MYSQL - PHP Database Connectivity
MYSQL - PHP Database ConnectivityMYSQL - PHP Database Connectivity
MYSQL - PHP Database Connectivity
 
MySQL developing Store Procedure
MySQL developing Store ProcedureMySQL developing Store Procedure
MySQL developing Store Procedure
 
Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8Upgrade to MySQL 5.7 and latest news planned for MySQL 8
Upgrade to MySQL 5.7 and latest news planned for MySQL 8
 
Mysql
MysqlMysql
Mysql
 
unit-ii.pptx
unit-ii.pptxunit-ii.pptx
unit-ii.pptx
 
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfytxjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
xjtrutdctrd5454drxxresersestryugyufy6rythgfytfyt
 
My sql technical reference manual
My sql technical reference manualMy sql technical reference manual
My sql technical reference manual
 
Database Connectivity in PHP
Database Connectivity in PHPDatabase Connectivity in PHP
Database Connectivity in PHP
 
What's New In PostgreSQL 9.4
What's New In PostgreSQL 9.4What's New In PostgreSQL 9.4
What's New In PostgreSQL 9.4
 
Sql lite android
Sql lite androidSql lite android
Sql lite android
 
Fudcon talk.ppt
Fudcon talk.pptFudcon talk.ppt
Fudcon talk.ppt
 
SQL PPT.pptx
SQL PPT.pptxSQL PPT.pptx
SQL PPT.pptx
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slides
 
Vertica-Database
Vertica-DatabaseVertica-Database
Vertica-Database
 
Trivadis TechEvent 2017 Oracle to My SQL Migration - Challenges by Robert Bia...
Trivadis TechEvent 2017 Oracle to My SQL Migration - Challenges by Robert Bia...Trivadis TechEvent 2017 Oracle to My SQL Migration - Challenges by Robert Bia...
Trivadis TechEvent 2017 Oracle to My SQL Migration - Challenges by Robert Bia...
 
MySQL Reference Manual
MySQL Reference ManualMySQL Reference Manual
MySQL Reference Manual
 
Learn PHP Lacture2
Learn PHP Lacture2Learn PHP Lacture2
Learn PHP Lacture2
 
MySQL for beginners
MySQL for beginnersMySQL for beginners
MySQL for beginners
 

Mais de Jamshid Hashimi

Week 2: Getting Your Hands Dirty – Part 2
Week 2: Getting Your Hands Dirty – Part 2Week 2: Getting Your Hands Dirty – Part 2
Week 2: Getting Your Hands Dirty – Part 2Jamshid Hashimi
 
Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1Jamshid Hashimi
 
Introduction to C# - Week 0
Introduction to C# - Week 0Introduction to C# - Week 0
Introduction to C# - Week 0Jamshid Hashimi
 
RIST - Research Institute for Science and Technology
RIST - Research Institute for Science and TechnologyRIST - Research Institute for Science and Technology
RIST - Research Institute for Science and TechnologyJamshid Hashimi
 
How Coding Can Make Your Life Better
How Coding Can Make Your Life BetterHow Coding Can Make Your Life Better
How Coding Can Make Your Life BetterJamshid Hashimi
 
Tips for Writing Better Code
Tips for Writing Better CodeTips for Writing Better Code
Tips for Writing Better CodeJamshid Hashimi
 
Launch Your Local Blog & Social Media Integration
Launch Your Local Blog & Social Media IntegrationLaunch Your Local Blog & Social Media Integration
Launch Your Local Blog & Social Media IntegrationJamshid Hashimi
 
Introduction to Blogging
Introduction to BloggingIntroduction to Blogging
Introduction to BloggingJamshid Hashimi
 
Introduction to Wordpress
Introduction to WordpressIntroduction to Wordpress
Introduction to WordpressJamshid Hashimi
 
CodeIgniter Helper Functions
CodeIgniter Helper FunctionsCodeIgniter Helper Functions
CodeIgniter Helper FunctionsJamshid Hashimi
 
CodeIgniter Class Reference
CodeIgniter Class ReferenceCodeIgniter Class Reference
CodeIgniter Class ReferenceJamshid Hashimi
 
Managing Applications in CodeIgniter
Managing Applications in CodeIgniterManaging Applications in CodeIgniter
Managing Applications in CodeIgniterJamshid Hashimi
 
PHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterPHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterJamshid Hashimi
 

Mais de Jamshid Hashimi (20)

Week 2: Getting Your Hands Dirty – Part 2
Week 2: Getting Your Hands Dirty – Part 2Week 2: Getting Your Hands Dirty – Part 2
Week 2: Getting Your Hands Dirty – Part 2
 
Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1Week 1: Getting Your Hands Dirty - Part 1
Week 1: Getting Your Hands Dirty - Part 1
 
Introduction to C# - Week 0
Introduction to C# - Week 0Introduction to C# - Week 0
Introduction to C# - Week 0
 
RIST - Research Institute for Science and Technology
RIST - Research Institute for Science and TechnologyRIST - Research Institute for Science and Technology
RIST - Research Institute for Science and Technology
 
How Coding Can Make Your Life Better
How Coding Can Make Your Life BetterHow Coding Can Make Your Life Better
How Coding Can Make Your Life Better
 
Mobile Vision
Mobile VisionMobile Vision
Mobile Vision
 
Tips for Writing Better Code
Tips for Writing Better CodeTips for Writing Better Code
Tips for Writing Better Code
 
Launch Your Local Blog & Social Media Integration
Launch Your Local Blog & Social Media IntegrationLaunch Your Local Blog & Social Media Integration
Launch Your Local Blog & Social Media Integration
 
Customizing Your Blog 2
Customizing Your Blog 2Customizing Your Blog 2
Customizing Your Blog 2
 
Customizing Your Blog 1
Customizing Your Blog 1Customizing Your Blog 1
Customizing Your Blog 1
 
Introduction to Blogging
Introduction to BloggingIntroduction to Blogging
Introduction to Blogging
 
Introduction to Wordpress
Introduction to WordpressIntroduction to Wordpress
Introduction to Wordpress
 
CodeIgniter Helper Functions
CodeIgniter Helper FunctionsCodeIgniter Helper Functions
CodeIgniter Helper Functions
 
CodeIgniter Class Reference
CodeIgniter Class ReferenceCodeIgniter Class Reference
CodeIgniter Class Reference
 
Managing Applications in CodeIgniter
Managing Applications in CodeIgniterManaging Applications in CodeIgniter
Managing Applications in CodeIgniter
 
CodeIgniter Practice
CodeIgniter PracticeCodeIgniter Practice
CodeIgniter Practice
 
CodeIgniter & MVC
CodeIgniter & MVCCodeIgniter & MVC
CodeIgniter & MVC
 
PHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterPHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniter
 
Exception & Database
Exception & DatabaseException & Database
Exception & Database
 
MySQL JOIN & UNION
MySQL JOIN & UNIONMySQL JOIN & UNION
MySQL JOIN & UNION
 

Último

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
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
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
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
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 

Último (20)

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
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
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
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!
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 

MySQL Record Operations

  • 1. MySQL Record Operations Jamshid Hashimi Trainer, Cresco Solution http://www.jamshidhashimi.com jamshid@netlinks.af @jamshidhashimi ajamshidhashimi Afghanistan Workforce Development Program
  • 2. Agenda • MySQLi Introduction • mysqli() Overview • mysqli Methods and Properties • INSERT, UPDATE & DELETE • mysqli Prepared Statements • Inserting, Updating and Deleting Records • Managing Data
  • 3. MySQLi Introduction • MySQLi, often called MySQL Improved, has several advantages over regular MySQL, including support for prepared statements (which helps prevent SQL injection, a common security issue) and object-oriented code.
  • 4. MySQLi Introduction • The mysqli extension has a number of benefits, the key enhancements over the mysql extension being: – Object-oriented interface – Support for Prepared Statements – Support for Multiple Statements – Support for Transactions – Enhanced debugging capabilities – Embedded server support
  • 6. MySQLi • mysqli_fetch_assoc (fetch_assoc()) – Fetch a result row as an associative array /* fetch associative array */ while ($row = $result->fetch_assoc()) { printf ("%s n", $row["Name”]); }
  • 7. MySQLi • mysqli_fetch_array (fetch_array()) – Fetch a result row as an associative, a numeric array, or both – MYSQLI_NUM – MYSQLI_ASSOC – MYSQLI_BOTH /* associative array */ $row = $result->fetch_array(MYSQLI_ASSOC); printf ("%sn", $row["Name”]);
  • 8. MySQLi • mysqli_fetch_object (fetch_object()) – Returns the current row of a result set as an object /* fetch object array */ while ($obj = $result->fetch_object()) { printf ("%s n", $obj->Name); }
  • 9. MySQLi • Do we need to close the connection? – Open connections (and similar resources) are automatically destroyed at the end of script execution. However, you should still close or free all connections, result sets and statement handles as soon as they are no longer required. This will help return resources to PHP and MySQL faster.
  • 10. INSERT • The INSERT INTO statement is used to insert new records in a table. • Syntax: INSERT INTO table_name (column1, column2, column3,...) VALUES (value1, value2, value3,...)
  • 11. UPDATE • The UPDATE statement is used to modify data in a table. • Syntax: UPDATE table_name SET column1=value, column2=value2,... WHERE some_column=some_value
  • 12. DELETE • The DELETE statement is used to delete records in a table. • Syntax: DELETE FROM table_name WHERE some_column = some_value
  • 13. Prepared Statements • Prepared statements provide developers with the ability to create queries that are more secure, have better performance, and are more convenient to write.
  • 14. Prepared Statements if($rs = $mysqli->prepare("SELECT first_name FROM actor WHERE first_name = ?")){ //binding parameteres $rs->bind_param("s",$name); $name = "BON"; //Execute it $rs->execute(); //Bind results $rs->bind_result($name); //Fetch records $rs->fetch(); printf("%s", $name); $rs->close(); }else{ echo $mysqli->error; } $mysqli->close();
  • 16. DEMO