PRACTICAL PHP AND MYSQL WALKTHROUGH USING SAMPLE CODES – MAX NG.

Slides:



Advertisements
Similar presentations
Housing and Dining Online by Andrew Gorges. Outline  Overview of PHP  Overview of MySQL  Using PHP  Using MySQL  PHP and MySQL together  Production.
Advertisements

Let’s try Oracle. Accessing Oracle The Oracle system, like the SQL Server system, is client / server. For SQL Server, –the client is the Query Analyser.
PHP (2) – Functions, Arrays, Databases, and sessions.
An Overview of Database Access on the Web An Overview of Database Access on the Web Using ASP and Microsoft Database Technology Sheffield Hallam University.
XP Tutorial 9 New Perspectives on JavaScript, Comprehensive1 Working with Cookies Managing Data in a Web Site Using JavaScript Cookies.
PHP & MySQL Mahak Arora Vivek Bangera. Outline How PHP works Basic scripting in PHP Forms in PHP(GET & POST Variables) SQL basics PHP and MySQL connection.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
Lecture 3 – Data Storage with XML+AJAX and MySQL+socket.io
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
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.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Cookies & Sessions.
Server-side Scripting Powering the webs favourite services.
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizard’s Guide to PHP by David Lash.
About Dynamic Sites (Front End / Back End Implementations) by Janssen & Associates Affordable Website Solutions for Individuals and Small Businesses.
MySQL + PHP.  Introduction Before you actually start building your database scripts, you must have a database to place information into and read it from.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
PHP and MySQL for Client-Server Database Interaction Chapter 10.
© 2003 By Default! A Free sample background from Slide 1 Week 2  Free PHP Hosting Setup  PHP Backend  Backend Security 
FUNCTIONS AND STORED PROCEDURES & FUNCTIONS AND PROTECTING A DB AND PHP (Chapters 9, 15, 18)
SHOPPING CARTS CHAPTER 19. E-COMMERCE Typically, an e-commerce site will have public pages and admin pages.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
1 Accelerated Web Development Course JavaScript and Client side programming Day 2 Rich Roth On The Net
HTML Hyper Text Markup Language A simple introduction.
Session 1 SESSION 1 Working with Dreamweaver 8.0.
COMP3121 E-Commerce Technologies Richard Henson University of Worcester November 2011.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
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.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
MySQL Databases & PHP Integration Using PHP to write data to, and retrieve data from, a MySQL database.
PHP and MySQL CS How Web Site Architectures Work  User’s browser sends HTTP request.  The request may be a form where the action is to call PHP.
E-COMMERCE JOBS This project (Project number: HU/01/B/F/PP ) is carried out with the financial support of the Commssion of the European Communities.
Top Five Web Application Vulnerabilities Vebjørn Moen Selmersenteret/NoWires.org Norsk Kryptoseminar Trondheim
Prof Frankl, Spring 2008CS Polytechnic University 1 Overview of Web database applications with PHP.
Dynamic web content HTTP and HTML: Berners-Lee’s Basics.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Web Database Programming Week 7 Session Management & Authentication.
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.
CS 149 Advance Perl Final Project Implementing an E-commerce shopping cart using cookies Presented by Dzung Tran.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
CS562 Advanced Java and Internet Application Introduction to the Computer Warehouse Web Application. Java Server Pages (JSP) Technology. By Team Alpha.
 Shopping Basket  Stages to maintain shopping basket in framework  Viewing Shopping Basket.
PHP, Databases, and Cookies Dave Pease IDS496 12/2/2003
CSC 405: Web Application Engineering II Course Preliminaries Course Objectives Course Objectives Students’ Learning Outcomes Students’ Learning Outcomes.
Creating Databases for Web Applications 3-Tier. Design vs Function vs Content. More SQL. More php. Homework: work on final projects.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 1: Introduction to IS2803 Rob Gleasure
CSC 2720 Building Web Applications Basic Frameworks for Building Dynamic Web Sites / Web Applications.
Web programming Part 1: environment 由 NordriDesign 提供
1 PHP HTTP After this lecture, you should be able to know: How to create and process web forms with HTML and PHP. How to create and process web forms with.
Intro to APACHE, MySQL, and PHP & freely available (hackable) Packages Aonghus Sugrue 04 Oct 2012.
Unit-6 Handling Sessions and Cookies. Concept of Session Session values are store in server side not in user’s machine. A session is available as long.
: Information Retrieval อาจารย์ ธีภากรณ์ นฤมาณนลิณี
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
© 2003 By Default! A Free sample background from Slide 1 Week 3  Backend Construction  Create your own CRM Please Visit:
CS 440 Database Management Systems Stored procedures & OR mapping 1.
PHP: Further Skills 02 By Trevor Adams. Topics covered Persistence What is it? Why do we need it? Basic Persistence Hidden form fields Query strings Cookies.
MESA A Simple Microarray Data Management Server. General MESA is a prototype web-based database solution for the massive amounts of initial data generated.
COM621: Advanced Interactive Web Development Lecture 10 PHP and MySQL.
Introduction to Dynamic Web Programming
Chapter 19 PHP Part III Credits: Parts of the slides are based on slides created by textbook authors, P.J. Deitel and H. M. Deitel by Prentice Hall ©
Web Design and Development
ISC440: Web Programming 2 Server-side Scripting PHP 3
Title: Tech Training Certificate: Ace of Initiative Program
Grocery Store Outline csc242 – web programming.
Web Application Development Using PHP
Presentation transcript:

PRACTICAL PHP AND MYSQL WALKTHROUGH USING SAMPLE CODES – MAX NG

WHY PHP AND MYSQL? Easy to learn and install Free to use and readily for download LAMP is a solution stack of free, open source software.solution stackfreeopen source Rich resources in WWW Well supported in PolyU COMP lab

PHP IN POLYU COMP LAB PHP (Apache) PHP files are to be placed in :/webhome/ /public_html Solaris Cluster Machine can be accessed thr PC using  WINSCP (file transfer)  PuTTY (Line command session) The website can be accessed using Web browser to the url link : /index.phpwww.comp.polyu.edu.hk/~<your

MYSQL IN POLYU COMP LAB MySQL A MySQL account is readily activated for your perusal. Account Details:  Host: mysql.comp.polyu.edu.hk:3306  User:  Password:  Schema: To directly manipulate your schema thr’ PC:  In Lab PC, there is a GUI Tool: "COMP" ->"Network Application Packages" ->"Database" - >"MySQL" ->"MySQLQBrowser“

WE WILL WALKTHROUGH PHP AND MYSQL TOGETHER Purpose oriented Start from Database table preparation To website implementation Using a simple website to study some basic coding technique My Book Store Using a advanced website to walkthrough a e-commerce system My Web Shop

AT THE END OF SESSION, WE SHOULD BE ABLE TO USE THE PROVIDED CODE TO BUILD A SIMPLE WEB SITE. 1.MySQL table setup  Create table  Insert record 2.Write PHP page  Connect to MySQL  Take the http-get parameters  Handle session  Looping control  Generate dynamic web page thr select statement

BASIC WEB PAGE DESIGN OF “MY BOOK STORE” 1.Request user login 2.Show product list and selection 3.Purchase list summary index.php books.php summary_order.php

WE HAVE TO CREATE A SCHEMA AT FIRST IN MYSQL. 1.Create the schema to house our new table. CREATE DATABASE ; Note: a.To remove the schema, we issue DROP DATABASE ; b.In COMP lab, we use only our login ID as our default schema. 2.Change our session to another schema by issuing USE ;

WE PUT THE BOOKLIST TABLE INTO THE ACTIVE SCHEMA. 1.Create table by issuing CREATE TABLE [IF NOT EXISTS] (,... PRIMARY KEY( ), FOREIGN KEY ( ) REFERENCES ( ) ) ; E.g. CREATE TABLE book_records_store( Book_No BIGINT NOT NULL AUTO_INCREMENT, Book VARCHAR(150) NOT NULL, Price DECIMAL(5,2) NOT NULL, PRIMARY KEY(Book_No))ENGINE=MyISAM AUTO_INCREMENT=1;

WE INSERT RECORDS INTO THE BOOKLIST TABLE. 1.Insert record by issuing INSERT INTO VALUES (,,...),... e.g. INSERT INTO book_records_store VALUES (null,'C++ for Starters','125.50'), (null,'Java AWT Package','178.50');

FINALLY, WE INSPECT THE TABLE CONTENT. Review the schemas we have  SHOW DATABASES; Set active schema by issuing  USE ; Review all table names in a schema  SHOW TABLES; Browse the table content  SELECT * | AS,..., AS FROM WHERE GROUP BY ORDER BY ASC|DESC,... HAVING LIMIT | ; e.g. SELECT * FROM book_records_store ;

BASIC WEB PAGE DESIGN OF “MY BOOK STORE” 1.Request user login 2.Show product list and selection 3.Purchase list summary index.php books.php summary_order.php

THE SIMPLEST FORM OF PHP PAGE IS ACTUALLY A PAGE OF HTML TAG. Index.php

WE HAVE TO PASS INPUT VALUES FROM INDEX.PHP TO BOOKS.PHP USING HTTP-GET … … index.php books.php (1) (2) (3) (2)

BASIC WEB PAGE DESIGN OF “MY BOOK STORE” 1.Request user login 2.Show product list and selection 3.Purchase list summary index.php books.php summary_order.php

WE SHOW THE LIST OF BOOKS IN OUR BOOKLIST TABLE IN THE BOOKS.PHP

PHP CODE IS EMBEDDED INTO HTML PAGE TO GENERATE THE BOOKLIST TABLE. 1.First of all, we connect to the database we just created and build our database query. include is to take the code from another php file and evaluate. databaseconfig.php

NEXT, CREATE SESSION TO LET VALUES TO BE AVAILABLE THROUGHOUT SESSION [2] $_GET: Return the http-get variable. Do you remember what is this variable? [4] $_REQUEST: Return the variable either in the array variables in http-get, http-post or cookies. [3] session_start(): start a session [5] $_SESSION: refer to a session variable to be available throughout the session [1] isset() : check null [1] [2] [3] [4] [5]

LASTLY, EXTRACT THE DATABASE QUERY RETURN AND CONSTRUCT THE BOOKLIST TABLE [1] [1] mysql_fetch_array() : Fetch a result row as an array [2] [2] echo : output http text [3] [3] in calling order_summary.php, http-get will pass an array with name “order[]” and value which is the price of the book.

ONLY THE CHECKBOX = ‘Y’ WILL BE HTTP-GET TO THE SUMMARY_ORDER.PHP &order%5B%5D=186.75&order%5B%5D=189.00&Ord =Order

BASIC WEB PAGE DESIGN OF “MY BOOK STORE” 1.Request user login 2.Show product list and selection 3.Purchase list summary index.php books.php summary_order.php

SUMMARY_ORDER.PHP CONSTRUCT THE ORDER TABLE AND OUTPUT AS HTTP PAGE [1] [1] session_start() : Retrieve the saved session. Now the session variable “firstN” and “lastN” available. [2] [2] count() : count the no. of element in an array [?] [?] We will discuss in the coming lab session.

SUMMARY_ORDER.PHP CONSTRUCT THE ORDER TABLE AND OUTPUT AS HTTP PAGE (CONT’D)

AT THE END OF SESSION, WE SHOULD BE ABLE TO USE THE PROVIDED CODE TO BUILD A SIMPLE WEB SITE. 1.MySQL table setup  Create table  Insert record 2.Write PHP page  Connect to MySQL  Take the http-get parameters  Handle session  Looping control  Generate dynamic web page thr select statement

FUNCTIONAL WALKTHROUGH: A ECOMMERCE SYSTEM USING PHP AND MYSQL

A COMPREHENSIVE ECOMMERCE SITE SHOULD BE ABLE TO: 1.Handle customer request in timely fashion 2.Provide sufficient information for customer to make purchase decision 3.Smoothen the process from product selection to payment 4.Maintain the product list and stock control 5.Maintain the order information 6.Maintain the customer information 7.Perform web advertising and site analytics

PRODUCT LIST INTEGRATED WITH SHOPPING CART

SHOPPING CART PROVIDED WITH DIRECT CHECKOUT OR BACK TO SHOPPING

CHECK OUT, PAYMENT AND NOTIFICATION ALL- DO IN ONE-TAKE

ADMINISTRATION: CATALOG, ORDER MANAGEMENT AND MINOR SCREEN LAYOUT

CATALOG MANAGEMENT ON PRODUCT, FEATURED PRODUCT LIST AND STOCK MANAGEMENT

TRACE CUSTOMER NEW ORDER AND FURTHER BACKEND PROCESSING

COMPREHENSIVE SITE CONFIGURATION ON VARIOUS SETTINGS

Thanks!!