MySQL Databases & PHP Integration Using PHP to write data to, and retrieve data from, a MySQL database.

Slides:



Advertisements
Similar presentations
PHP II Interacting with Database Data. The whole idea of a database-driven website is to enable the content of the site to reside in a database, and to.
Advertisements

PHP SQL. Connection code:- mysql_connect("server", "username", "password"); Connect to the Database Server with the authorised user and password. Eg $connect.
INTRODUCTION The Group WEB BROWSER FOR RELATION Goals.
ASP.NET Database Connectivity I. 2 © UW Business School, University of Washington 2004 Outline Database Concepts SQL ASP.NET Database Connectivity.
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial Password: UWPstudent Password is case sensitive.
1 CS428 Web Engineering Lecture 23 MySQL Basics (PHP - VI)
MySql In Action Step by step method to create your own database.
Lecture 3 – Data Storage with XML+AJAX and MySQL+socket.io
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,
Advanced Web 2012 Lecture 4 Sean Costain PHP Sean Costain 2012 What is PHP? PHP is a widely-used general-purpose scripting language that is especially.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Create an online booking system (login/registration)
Analysis of SQL injection prevention using a proxy server By: David Rowe Supervisor: Barry Irwin.
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizard’s Guide to PHP by David Lash.
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
Tutorial 10 Adding Spry Elements and Database Functionality Dreamweaver CS3 Tutorial 101.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
CS 3630 Database Design and Implementation. Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial.
Accessing MySQL with PHP IDIA 618 Fall 2014 Bridget M. Blodgett.
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.
Lec_6 Manipulating MySQL Databases with PHP PHP Programming with MySQL.
Chapter 6 PHP Interacts with Mysql Database. Introduction In PHP, there is no consolidated interface. Instead, a set of library functions are provided.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
SYST Web Technologies SYST Web Technologies Databases & MySQL.
Technology & Management Club Development Software Overview.
PHP with MySQL 1.
PHP+MySQL Integration. Connecting to databases One of the most common tasks when working with dynamic webpages is connecting to a database which holds.
CMS Content Management Systems. What is a CMS? Creation and management system for websites Wikipedia.org definition: A content management system (CMS)
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
Most information comes from Chapter 3, MySQL Tutorial: 1 MySQL: Part.
Creating PHPs to Insert, Update, and Delete Data CS 320.
A Guide to MySQL 3. 2 Introduction  Structured Query Language (SQL): Popular and widely used language for retrieving and manipulating database data Developed.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Controlling Web Site Access Using Logins CS 320. Basic Approach HTML form a php page that collects the username and password  Sends them to second PHP.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
SQL has several parts: Major ones: DDL – Data Definition Language {Defining, Deleting, Modifying relation schemas} DML – Data Manipulation Language {Inserting,
>> PHP: MySQL & CRUD. R ecall Database Tables Records is composed of Operations (CRUD) Create Retrieve Update Delete DBMS Access Control MySQL phpMyAdmin.
CP476 Internet Computing Perl CGI and MySql 1 Relational Databases –A database is a collection of data organized to allow relatively easy access for retrievals,
Education And Training CTC IT DIVISION PivotLink User Training April 2010.
Programming for the Web MySQL Command Line Using PHP with MySQL Dónal Mulligan BSc MA
Software-Projekt 2008 Seminarvortrag“Short tutorial of MySql“ Wei Chen Verena Honsel.
COM621: Advanced Interactive Web Development Lecture 10 PHP and MySQL.
CS 3630 Database Design and Implementation
Chapter 5 Introduction to SQL.
Introduction to Dynamic Web Programming
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
CS320 Web and Internet Programming SQL and MySQL
SQL and SQL*Plus Interaction
Introduction to MySQL.
Unix System Administration
Introduction to Web programming
MySQL Working on Turing.
PHP Overview PHP: Hypertext Preprocessor Server-Side Scripting
Chapter 7 Working with Databases and MySQL
Web Systems Development (CSC-215)
Relational Database Design
CS3220 Web and Internet Programming SQL and MySQL
MySQL Database System Installation Overview SQL summary
Presentation transcript:

MySQL Databases & PHP Integration Using PHP to write data to, and retrieve data from, a MySQL database

Interacting with Databases We used XML pages statically to act as databases Relational Database: Think of an Excel document where each worksheet is a table within the document (database) A table is rows / columns while a database is records / fields Data is stored in database, not RAM as with XML

MySQL Command Line Login: mysql –u username –p (prompt for password) SHOW DATABASES, CREATE, ALTER, DROP, SELECT, INSERT, UPDATE, DELETE Must use commands (in all caps) and semicolons (;) at the end to execute strings

phpMyAdmin Web-based database management system written in PHP Used to manipulate any database item, view items, perform queries, etc… Table Creation: Field Name, Type (usually VARCHAR), Length Values, Collation, Attributes, Null, Default, Extra Login using your username (flastname) and password (password)

Databases and PHP PHP function: “mysqli_connect” / “mysqli_close” Test our connection to our database using PHP MySQL Client Version: “, mysqli_get_client_info(), “ ”; echo “ MySQL Connection: “, mysqli_get_host_info($dbconnect), “ ”; echo “ MySQL Protocol Version: “, mysqli_get_proto_info($dbconnect), “ ”; echo “ MySQL Server Version: “, mysqli_get_server_info($dbconnect), “ ”; mysqli_close($dbconnect); ?>

sample1.html & sample1.php sample1.html – grabs user input in an HTML form and holds it in memory sample1.php – connects to a MySQL database for the insertion of the data to the table Spring2011/Lecture5/ View sample1.html and sample1.php’s code View phpMyAdmin to see the customer database – sample1 table records

dbexample1.html & dbexample1.php dbexample1.html – provides a username/password field for logging into the database dbexample1.php– connects to a MySQL database for the selection and viewing of table data in an organized table Spring2011/Lecture5/ View dbexample1.html and dbexample1.php’s code View phpMyAdmin to see the customer database – sample1 table records

order.html & order.php order.html gathers data and sends it to order.php for verification Nothing is written to the database…data is just reprinted on the screen Spring2011/Lecture5/orders/

orderdb.html & orderdb.php orderdb.html gathers data and sends it to orderdb.php for verification orderdb.php inputs that data into a database for storage using fields corresponding to the form variables Spring2011/Lecture5/orders/

orderdboutput.html & orderdboutput.php orderdboutput.html provides a login form for a user to log in and view the contents of the database table orderdboutput.php grabs the entered username/password, checks it against the databse, then displays the table records in an organized HTML table Spring2011/Lecture5/orders/