Intro to LAMP Programming Presented for CIS Faculty at SAC by Dan Zollars.

Slides:



Advertisements
Similar presentations
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Advertisements

NMED 3850 A Advanced Online Design February 25, 2010 V. Mahadevan.
Creating WordPress Websites. Creating a site on your computer Local server Local WordPress installation Setting Up Dreamweaver.
Multiple Tiers in Action
A Guide to SQL, Seventh Edition. Objectives Understand the concepts and terminology associated with relational databases Create and run SQL commands in.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Dynamic Web site With PHP and MySQL. MySQL The combination of MySQL database and PHP scripting language is optimum for building dynamic websites. MySQL.
Database Basics CS Why use a database?  powerful: can search it, filter data, combine data from multiple sources  fast: can search/filter a database.
Web Page A page displayed by the browser. Website Collection of multiple web pages Web Browser: A software that displays web pages on client computer.
PHP and MySQL Week#1  Course Plan.  Introduction to Dynamic Web Content.  Setting Up Development Server Eng. Mohamed Ahmed Black 1.
DATA, DATABASES, AND QUERIES Managing Data in Relational Databases CS1100Microsoft Access - Introduction1.
DATA, DATABASES, AND QUERIES Managing Data in Relational Databases CS1100Microsoft Access - Introduction1 Created By Martin Schedlbauer
SJSU CS157B Dr. Lee1  2004 Jenny Mitchell Two Useful Tools You Can’t Live Without by Jenny Mitchell SJSU CS157B Section PHP and MySQL.
Application Development Description and exemplification of server-side scripting language for server connection, database selection, execution of SQL queries.
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Cookies & Sessions.
INTERNET APPLICATION DEVELOPMENT For More visit:
Server-side Scripting Powering the webs favourite services.
INTERNET APPLICATION DEVELOPMENT PRACTICAL ON CONNECTING TO MYSQL.
Multifarious Project Team Members Alberto Dominguez Nirmit Gang Jimmy Garcia Javier Handal.
Introduction to databases and SQL. What is a database?  A database is an organized way of holding together pieces of information  A database refers.
SQL Queries Relational database and SQL MySQL LAMP SQL queries A MySQL Tutorial and applications Database Building Assignment.
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.
Installing and Using MySQL and phpMyAdmin. Last Time... Installing Apache server Installing PHP Running basic PHP scripts on the server Not necessary.
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.
Introduction to Internet Databases MySQL Database System Database Systems.
School of Computing and Information Systems CS 371 Web Application Programming PHP – Forms, Cookies, Sessions and Database.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
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.
 2004 Prentice Hall, Inc. All rights reserved. 1 Segment – 6 Web Server & database.
1 Welcome to CSC 301 Web Programming Charles Frank.
© Anselm Spoerri Web Design Information Visualization Course Prof. Anselm Spoerri
PHP - MySQL Connection 8 March 2006 Adina Crainiceanu IT420: Database Management and Organization.
Lotus 认证培训 Notes Domino 6/6.5 Application Development Foundation Skills ( 610 ) Exam Number: 610 Competencies: Please see exam guide. Length:
CHAPTER 7 Form & PHP. Introduction All of the following examples in this section will require two web pages. The first page retrieves information posted.
Intro to DatabasesClass 4 SQL REVIEW To talk to the database, you have to use SQL SQL is used by many databases, not just MySQL. SQL stands for Structured.
14. Uploading Files to MySQL Database. M. Udin Harun Al Rasyid, S.Kom, Ph.D Desain dan.
CS1100: Microsoft Access Managing Data in Relational Databases Created By Martin Schedlbauer CS11001Microsoft Access - Introduction.
Intro to LAMP Programming Presented for SAT Linux Users' Group by Dan Zollars.
Dynamic web content HTTP and HTML: Berners-Lee’s Basics.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP & MySQL.
PHP Database connectivity Connecting with RDBMS and editing, adding, and deleting databases therein are all done through PHP functions.
Basic HTML HTML document consists of text markup tags interspersed in the text Example: Example 1 Example 1 Here goes the text This is a second paragraph.
CIS 375—Web App Dev II SQL. 2 Introduction SQL (Structured _______ Language) is an ANSI standard language for accessing databases.ANSI SQL can execute.
CIS 375—Web App Dev II SQL. 2 Introduction SQL (Structured _______ Language) is an ANSI standard language for accessing databases.ANSI SQL can execute.
PHP and Mysql Database. PHP and Database Mysql – popular open-source database management system PHP usually works with Mysql for web-based database applications.
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.
Microsoft Access is a database program to manage sort retrieve group filter for certain records.
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
MySQL. Is a SQL (Structured Query Language) database server. Can be accessed using PHP with embedded SQL Queries Supports Large DB’s, 60,000 tables with.
Creating Databases applications for the Web: week 2 Basic HTML review, forms HW: Identify unique source for asp, php, Open Source, MySql, Access.
Web programming Part 1: environment 由 NordriDesign 提供
Display Page (HTML/CSS)
Drilling down Restrictions on data interaction between browser and server a new connection has to be made for each interaction Solution: break up the data.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP.
Programming for the Web MySQL Command Line Using PHP with MySQL Dónal Mulligan BSc MA
4.01 How Web Pages Work.
PHP / MySQL Introduction
ISC440: Web Programming 2 Server-side Scripting PHP 3
PHP and MySQL.
Introduction To Structured Query Language (SQL)
PHP and Forms.
Tutorial 6 PHP & MySQL Li Xu
PHP and MySQL.
4.01 How Web Pages Work.
Presentation transcript:

Intro to LAMP Programming Presented for CIS Faculty at SAC by Dan Zollars

What is LAMP? Linux Apache MySQL PHP Number one HTTP server on the Internet Most popular open-source database Widely used, general purpose scripting language

Getting Started Website resources – see then LAMP demo Need only vi editor and browser – working directly on sol using programs already set up Put programs in public_html under personal directory

Topics Testing Apache & PHP Integrating PHP and HTML Targeting a PHP script from an HTML form Retrieving information from MySQL databases Accessing MySQL databases from PHP Practice

Testing Apache & PHP In browser: Any document in public_html is available for Apache to serve to client (even if no link) /home/yourname/public_html/sample.html Using Minimal XHTML document Testing PHP: Example 1

Integrating PHP & HTML \$i = $i \n”; // more php code ?> Example 2

Targeting a PHP script Now in target.php: $field_name = $_POST['field_name']; Example 3

Practice - 1 Write the target script for example3.php

Practice - 1 (answers) The name you entered was: $lastname \n"; ?>

Retrieving MySQL Information SELECT { | *} FROM [,...] [WHERE ] [ORDER BY [DESC] ] [GROUP BY ] ;

SELECT Clause Use the SELECT clause to restrict which columns to display SELECT firstname, lastname, SELECT qty, item_desc SELECT *

FROM Clause Use the FROM clause to specify which table(s) to retrieve the data from SELECT firstname, lastname, FROM customers; SELECT * FROM orders;

WHERE Clause Use the WHERE clause to restrict the number of rows to display SELECT qty, item_desc FROM items WHERE qty > 1; SELECT * FROM orders WHERE paid IS NULL;

JOINS Several kinds Common column Can use either the FROM or WHERE clause

JOIN - WHERE Uses the WHERE clause to specify join condition SELECT order_id, order_date, lastname FROM orders, customers WHERE orders.cust_id = customers.cust_id; SELECT qty, item_desc FROM items, orders WHERE items.order_id = orders.order_id AND items.order_id = 1002;

Practice - 2 Use the satlug database to find out the following: Names and addresses of all the customers How many orders for each customer (just list them and count)? List the unfinished orders (completed IS NULL) List the orders that have been shipped but haven't been paid for yet How many carrots did Bugs Bunny order (join items to orders where cust_id = 4)?

Practice - 2 (answers) SELECT firstname, lastname, address, city, state FROM customers; SELECT * FROM orders; SELECT * FROM orders WHERE completed IS NULL;

Practice - 2 (answers) SELECT * FROM orders WHERE completed IS NOT NULL AND paid IS NULL; SELECT qty, item_desc FROM items, orders WHERE items.order_id = orders.order_id AND orders.cust_id = 4;

Accessing MySQL from PHP $link = mysql_connect(“host”, “name”, “pw”); mysql_select_db(“satlug”, $link); $result = mysql_query($query); while ($row = mysql_fetch_array($result)) echo “$row[0] $row[1] \n”;// etc. die(“Error message”. mysql_error()); Example 4

Practice - 3 Modify example 3 source and target as follows: Client enters last name, target displays first and last names Client enters cust_id, target displays order id and order date for all orders Client enters order_id, target displays qty and description

Using $_GET In source file, create a link with parameter Text In target file, use $_GET superglobal to get info $id = $_GET['id']; Creates different html for each table entry Still only two files

Practice - 4 Modify practice 3 source and target as follows: Source looks up customer names, presents as links to target using HTTP parameter (display name, use id as parameter) Target uses $_GET to determine cust_id, then looks up other customer information Target displays information