PHP Database Pemrograman Internet. PHP MySQL Database With PHP, you can connect to and manipulate databases. MySQL is the most popular database system.

Slides:



Advertisements
Similar presentations
UFCE8V-20-3 Information Systems Development 3 (SHAPE HK)
Advertisements

DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
What is MySQL? MySQL is a database. The data in MySQL is stored in database objects called tables. A table is a collections of related data entries and.
PHP1-1 PHP & SQL Xingquan (Hill) Zhu
© Yanbu University College YANBU UNIVERSITY COLLEGE Management Science Department © Yanbu University College Module 6:WEB SERVER AND SERVER SIDE SCRPTING,
INTERNET APPLICATION DEVELOPMENT For More visit:
PDO, PHP Data Object Use a Database with PHP
PHP MySQL Introduction
INTERNET APPLICATION DEVELOPMENT PRACTICAL ON CONNECTING TO MYSQL.
1 Overview of Databases. 2 Content Databases Example: Access Structure Query language (SQL)
 Mysql – popular open-source database management system  PHP usually works with Mysql for web- based database applications  LAMP applications—Web-based.
15/10/20151 PHP & MySQL 'Slide materials are based on W3Schools PHP tutorial, 'PHP website 'MySQL website.
Introduction to MySQL Lab no. 10 Advance Database Management System.
PHP MySQL Introduction. MySQL is the most popular open-source database system. What is MySQL? MySQL is a database. The data in MySQL is stored in database.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
SYST Web Technologies SYST Web Technologies Databases & MySQL.
PHP Part 2.
Lecture 10 – MYSQL and PHP (Part 2)
Technology & Management Club Development Software Overview.
CPS120: Introduction to Computer Science Lecture 19 Introduction to SQL.
PHP with MySQL 1.
Hibernate 3.0. What is Hibernate Hibernate is a free, open source Java package that makes it easy to work with relational databases. Hibernate makes it.
2010/11 : [1]PHP with MySQLBuilding Web Applications using MySQL and PHP (W1) PHP with MySQL.
Web Programming Language Week 7 Dr. Ken Cosh PHP and storage.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Course FAQ’s I do not have any knowledge on SQL concepts or Database Testing. Will this course helps me to get through all the concepts? What kind of.
SQL Jan 20,2014. DBMS Stores data as records, tables etc. Accepts data and stores that data for later use Uses query languages for searching, sorting,
PHP and Mysql Database. PHP and Database Mysql – popular open-source database management system PHP usually works with Mysql for web-based database applications.
Module Review Basic SQL commands: Create Database, Create Table, Insert and Select 2. Connect an SQL Database to PHP 3. Execute SQL Commands in.
PHP Workshop ‹#› PHP Data Object (PDO). PHP Workshop ‹#› What is PDO? PDO is a PHP extension to formalise PHP's database connections by creating a uniform.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Creating A Database Driven Website 1.Setting Up Your Web Server 2.Creating a Database 3.Creating a Webpage to Display Information From a Database 4.Creating.
PHP: MySQL. PHP Connect to MySQL PHP 5 and later can work with a MySQL database using: – MySQLi extension (the "i" stands for improved) – PDO (PHP Data.
LECTURE 3 MYSQL Database. PHP MYSQL CONNECTION MySQL is a database system used on the web MySQL is a database system that runs on a server MySQL is ideal.
CHAPTER 10 PHP MySQL Database
CSC 2720 Building Web Applications Accessing MySQL from PHP.
MySQL MySQL and PHP – interacting with a database.
INLS 623 – D ATABASE A PPLICATION D EVELOPMENT AND I NTERNET A PPLICATIONS Instructor: Jason Carter.
Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Fundamentals of Web DevelopmentRandy.
13 – PHP MySQL Connection Informatics Department Parahyangan Catholic University.
به نام خدا SQL QUIZ جوانمرد Website: ejavanmard.blogfa.com.
PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used, free, and efficient alternative.
 MySQL is a database system used on the web  MySQL is a database system that runs on a server  MySQL is ideal for both small and large applications.
PHP & MY SQL Instructor: Monireh H. Sayadnavard 1.
Web Systems & Technologies
PHP Built-In Functions
PHP: MySQL Lecture 14 Kanida Sinmai
CS320 Web and Internet Programming SQL and MySQL
IS1500: Introduction to Web Development
Introduction to Web programming
Session 4 PHP & MySQL.
Web Design and Development
Server-Side Application and Data Management IT IS 3105 (FALL 2009)
Introduction to Web programming
Multitier Architecture, MySQL & PHP
ISC440: Web Programming 2 Server-side Scripting PHP 3
Introduction to Web programming
MySQL Web Application Connecting to a MySQL database
PHP and MySQL.
PHP Hüseyin GÜNEŞ, 2018.
Web Programming Language
Tutorial 6 PHP & MySQL Li Xu
CS3220 Web and Internet Programming SQL and MySQL
PHP and MySQL.
MySQL Web Application Connecting to a MySQL database
PHP Forms and Databases.
CS3220 Web and Internet Programming SQL and MySQL
Introduction to Web programming
Conection
PHP By Prof. B.A.Khivsara Note: The material to prepare this presentation has been taken from internet and are generated only for students reference and.
Presentation transcript:

PHP Database Pemrograman Internet

PHP MySQL Database With PHP, you can connect to and manipulate databases. MySQL is the most popular database system used with PHP

What is MySQL? MySQL is a database system used on the web MySQL is a database system that runs on a server MySQL is ideal for both small and large applications MySQL is very fast, reliable, and easy to use MySQL uses standard SQL MySQL compiles on a number of platforms MySQL is free to download and use MySQL is developed, distributed, and supported by Oracle Corporation

MySQL database The data in a MySQL database are stored in tables. A table is a collection of related data, and it consists of columns and rows. Databases are useful for storing information categorically. A company may have a database with the following tables: – Employees – Products – Customers – Orders

PHP Connect to MySQL PHP 5 and later can work with a MySQL database using: MySQLi extension (the "i" stands for improved) PDO (PHP Data Objects)

MySQLi & PDO Both are object-oriented, but MySQLi also offers a procedural API PDO will work on 12 different database systems, MySQLi will only work with MySQL databases

Open a Connection to MySQL Example (MySQLi Object-Oriented) Example (MySQLi Procedural) Example (PDO)

Example (MySQLi Object-Oriented) connect_error) { die("Connection failed: ". $conn->connect_error); } echo "Connected successfully"; ?>

Example (MySQLi Procedural)

Example (PDO) setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Connected successfully"; } catch(PDOException $e) { echo "Connection failed: ". $e->getMessage(); } ?>

Close the Connection

PHP Insert Data Into MySQL Insert Data Into MySQL Using MySQLi Insert Data Into MySQL Using PDO

Example (MySQLi Object-oriented) connect_error) { die("Connection failed: ". $conn->connect_error); } $sql = "INSERT INTO MyGuests (firstname, lastname, ) VALUES ('John', 'Doe', if ($conn->query($sql) === TRUE) { echo "New record created successfully"; } else { echo "Error: ". $sql. " ". $conn->error; } $conn->close(); ?>

Example (MySQLi Procedural) ". mysqli_error($conn); } mysqli_close($conn); ?>

Example (PDO) setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "INSERT INTO MyGuests (firstname, lastname, ) VALUES ('John', 'Doe', // use exec() because no results are returned $conn->exec($sql); echo "New record created successfully"; } catch(PDOException $e) { echo $sql. " ". $e->getMessage(); } $conn = null; ?>

Select Data With MySQLi Example (MySQLi Procedural) Example (MySQLi Object-oriented)

connect_error) { die("Connection failed: ". $conn->connect_error); } $sql = "SELECT id, firstname, lastname FROM MyGuests"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { echo "id: ". $row["id"]. " - Name: ". $row["firstname"]. " ". $row["lastname"]. " "; } } else { echo "0 results"; } $conn->close(); ?>

Example (MySQLi Procedural) 0) { // output data of each row while($row = mysqli_fetch_assoc($result)) { echo "id: ". $row["id"]. " - Name: ". $row["firstname"]. " ". $row["lastname"]. " "; } } else { echo "0 results"; } mysqli_close($conn); ?>

PHP Delete Data From MySQL Example (MySQLi Object-oriented) Example (MySQLi Procedural)

Example (MySQLi Object-oriented) connect_error) { die("Connection failed: ". $conn->connect_error); } // sql to delete a record $sql = "DELETE FROM MyGuests WHERE id=3"; if ($conn->query($sql) === TRUE) { echo "Record deleted successfully"; } else { echo "Error deleting record: ". $conn->error; } $conn->close(); ?>

Example (MySQLi Procedural)

PHP Update Data in MySQL Example (MySQLi Object-oriented) Example (MySQLi Procedural)

Example (MySQLi Object-oriented) connect_error) { die("Connection failed: ". $conn->connect_error); } $sql = "UPDATE MyGuests SET lastname='Doe' WHERE id=2"; if ($conn->query($sql) === TRUE) { echo "Record updated successfully"; } else { echo "Error updating record: ". $conn->error; } $conn->close(); ?>

Example (MySQLi Procedural)