ADVM420- Class #1 Web Design with PHP and MySQL Introduction to PHP © Copyright 2007 Grant Macewan College Micah Slavens -

Slides:



Advertisements
Similar presentations
Copyright © 2003 Pearson Education, Inc. Slide 1-1 The Web Wizards Guide to PHP by David A. Lash.
Advertisements

PHP I.
Java Script Session1 INTRODUCTION.
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
Server-Side vs. Client-Side Scripting Languages
IST 221 Internet Concepts and Applications Introduction to PHP.
1 Web Wizards Guide To PHP David Lash Chapter 1 Introduction to PHP.
CIS101 Introduction to Computing Week 05. Agenda Your questions CIS101 Survey Introduction to the Internet & HTML Online HTML Resources Using the HTML.
Website Development with PHP and MySQL Introduction.
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
Chapter 2 Introduction to HTML5 Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
Web Programming Language Dr. Ken Cosh Week 1 (Introduction)
PHPPHP What is PHP? Hypertext Pre-processor (PHPs) is a server- side scripting language In early versions, PHP stand for Personal Home Page. server-side.
PHP By Dr. Syed Noman Hasany. PHP PHP was originally created by Rasmus Lerdorf in PHP stands for PHP: Hypertext Preprocessor (a recursive acronym).
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
Overview of HTML. Three Different Approaches  Text editor like Notepad  HTML editor such as: –KompoZer –DreamWeaver –Microsoft Expression Web –iWeb.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
ALBERT WAVERING BOBBY SENG. Week Whatever: PHP  Announcements/questions/complaints.
CSC 318 WEB APPLICATION DEVELOPMENT.  Introduction to Server Scripting language  Client VS Server  Introduction to PHP  PHP Files and Syntax  Function.
Website Development & Management Introduction & Overview CIT Fall Instructor: John Seydel, Ph.D.
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.
ITD 3194 Web Application Development Chapter 4: Web Programming Language.
Languages in WEB Presented by: Jenisha Kshatriya BCM SS09.
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
Chapter 1: Introduction to Web
With your friendly Web Developer, Chris.. Terminology  HTML - > Hypertext Markup Language  CSS -> Cascading Style Sheet  open tag  close tag  HTTP->Hypertext.
IDK0040 Võrgurakendused I harjutus 06: PHP: Introduction Deniss Kumlander.
INTERNET APPLICATION DEVELOPMENT For More visit:
Nael Alian Introduction to PHP
10/5/2015CS346 PHP1 Module 1 Introduction to PHP.
Overview of HTML/XHTML Two Different Approaches  Text editor like Notepad  HTML editor such as: –KompoZer –DreamWeaver –Microsoft Expression Web –iWeb.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Kingdom of Saudi Arabia Ministry of Higher Education Al-Imam Muhammad Ibn Saud Islamic University College of Computer and Information Sciences Chapter.
HTML Basics BCIS 3680 Enterprise Programming. Web Client/Server Architecture 2  Your browser (the client) requests a Web page from a remote computer.
PHP. What is PHP? PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server.
Introduction to PHP Advanced Database System Lab no.1.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
CSE 154 LECTURE 5: INTRO TO PHP. URLs and web servers usually when you type a URL in your browser: your computer looks up the.
Overview of Form and Javascript fundamentals. Brief matching exercise 1. This is the software that allows a user to access and view HTML documents 2.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
ASP (Active Server Pages) by Bülent & Resul. Presentation Outline Introduction What is an ASP file? How does ASP work? What can ASP do? Differences Between.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
IT ELECTIVE 2.  Web server Can refer to either the hardware (the computer) or the software (the computer application) that helps to deliver content that.
WHAT IS SERVER SIDE SCRIPTING? Server-side scripting is a web server technology in which a user's request is verified by running a script directly on the.
Scripting Languages Client Side and Server Side. Examples of client side/server side Examples of client-side side include: JavaScript Jquery (uses a JavaScript.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
Unit 1 – Web Concepts Instructor: Brent Presley.
Creating Web Documents: JavaScript Ftp / file management: review Introduction to JavaScript Sources Homework: start review for midterm, work on Project.
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
Higher Computing Science Coding the Web: HTML, JavaScript, PHP and MySQL.
1 PHP Intro PHP Introduction After this lecture, you should be able to: Know the fundamental concepts of Web Scripting Languages in general, PHP in particular.
PHP Form Processing * referenced from
CHAPTER 7 LESSON C Creating Database Reports. Lesson C Objectives  Display image data in a report  Manually create queries and data links  Create summary.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
HTML Introduction HTML Editors HTML Basic HTML Elements HTML Attributes HTML Headings HTML Paragraphs HTML Formatting HTML Links HTML Head HTML CSS HTML.
PHP stands for …….. “PHP Hypertext Pre-processor” and is a server-side scripting language like ASP. PHP scripts are executed on the server PHP supports.
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.
PHP using MySQL Database for Web Development (part II)
Introduction to Dynamic Web Programming
Introduction and Principles
PHP Introduction.
Module 1 Introduction to PHP 11/30/2018 CS346 PHP.
PHP.
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
An Introduction to JavaScript
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Web Application Development Using PHP
Presentation transcript:

ADVM420- Class #1 Web Design with PHP and MySQL Introduction to PHP © Copyright 2007 Grant Macewan College Micah Slavens -

Introduction Course Title Web design with PHP and MySQL Objectives Build dynamic, data-driven websites Gain the skills to learn and move forward Target Audience Some knowledge of HTML, databases, & programming is recommended Facilities Washrooms, cafeteria, parking Introductions and Interests What brought you to this course?

Target Environments Client Machine requirements: Text Editor FTP Server requirements: Can be Windows/Mac/Linux based Download & install appropriate software See reference Installing PHP & MySQL on

Agenda Day 1: Web development concepts Tools of the trade HTML review Introduction to Scripting with PHP Include files HTML Forms & Validation Day 2: Listing data from MySQL Adding data to MySQL Creating Web applications Wrap-up

Web Development Concepts What is a Web Server? What is a Web Client? Static Web Pages HTML only Dynamic Web Pages HTML with Scripting language

Dynamic Web Pages Client Side AJAX – (Asynchronus Javascript & XML) DOM Scripting Flash Server Side Pre-processor that generates HTML Numerous scripting languages available PHP, Python, Ruby, ASP, ColdFusion, JSP, Perl, etc…

Server-Side Technology Advantages Ability to store data long term Code is protected Code logic is only visible through FTP (login protected) Potentially faster download times Code does not travel to client - public only sees results Disadvantages More load on server Server must support technology Less portability More knowledge required

Development Strategies Develop locally / upload to server Does not require permanent connection Can use your own resources (but you have to manage them) Does not interfere with existing site More control if things go wrong… Develop directly on a server via FTP You’ll be sure it works Easier in a team environement

Tools of the Trade We will be developing code on our server using a text Editor There are tools that will write blocks of code for you, but a text editor will give you a greater understanding of what you’re doing We won’t look at installing PHP or MySQL in class, but you’re welcome to give it a try on your own computer at home

XHTML Review Using Text Editor, create An index.html page 2 directories, called: /images /documents Heading Image (linked to in image directory) An unordered list Links to your 3 favorite sites An ordered list Steps to making a pb & j sandwich Save View

Web Standards W3C Standards make a better internet A usable standards based site will have a greater return No tables based designs! Semantic markup is beautiful Use only XHTML elements Make use of all the elements you can Clean markup and CSS will make a lighter, more usable application

Basic PHP Rules PHP script files end with the.php extension Scripting statements are enclosed in tags: <?PHP print (date("M d, Y")); ?> More simply: Or Try it! Rename your file index.php and include the lines shown above to show the server’s date

Data types in PHP PHP is four simple data types: Number (1, -5, 22.35, ) String (“My dog”, “123 Any Street”) Boolean (true/false) Null Compound data types: Array$age[‘Bill’] = 15; $car[1] = “Ford”; Object

Variables and Statements Statements end with the semi-colon ; Capitalization is important! Variable names always prefixed with $ Comments begin with // $x = 15 / 9;//line1 comment $y = (65 * $x) % 15;//line2 comment

PHP Operators Math operators: + - * / %(Remainder) String operator:.(Concatenation) Comparison operators && AND ||OR !NOT

Program Output As we have seen, all output to the browser window is done using the print() or echo() functions (you can include html): <?PHP $x = 15 / 9; //comment $y = (65 * $x) % 15; print(“ The answer is: $y ”); ?>

Self-test: Simple Statements Write a program in PHP that calculates and displays a 10% discount on $ Ensure all output has labels and make it appear on separate lines.

Program Blocks Program blocks are always contained in braces {…} if () {…} else {…} switch() {…} while() {…} do {…} while() for(;;) {…} function xyz() {…}

Decisions: if() {…} else {…} Syntax: if (condition) { true_statements; } else { false_statements; } Example: if ($x >= 10) { $x = $x * 0.9;//discount 10% } else { $x = $x * 0.95;//discount 5% }

Self-test: if() {…} else {…} Write a program in PHP that prints the words: “infant” if the variable $age is less than 1 “toddler” if the variable $age is less than 2 “child” if the variable $age is less than 13 “teen” if the variable $age is less than 18 “adult” otherwise

Decisions: switch () {…} Syntax: switch (value) { case N: statements; break; … default: statements; break; } Example: switch ($month) { case 1: print (“Jan”); break; case 2: print (“Feb”); break; default: print (“Err”); break; }

Self-test: switch () {…} Write a program in PHP that displays: “BMW200” if the variable $car is 200 “BMW203” if the variable $car is 203 “BMW205” if the variable $car is 205 “Error” otherwise

Loops: while() {…} Syntax: while (condition) { statements; } Example: What does this program do? $i = 0; $s = 0; while ($i < 7) { $s = $s + $i; $i = $i + 1; } print(“s= $s \n”);

Self-test: while() {…} Powers of Two Write a program that displays the series 2,4,8,16,32,64… until the number becomes greater than 5000.

Loops: do {…} while() Syntax: do { statements; } while (condition); Example: What does this program do? $i = 0; do { print(“i=“. $i. “ \n”); } while ($i != 0); do {…} while() always runs at least once.

Loops: for(;;) {…} Syntax: for (initialize; condition; increment) { statements; } Example: What does this program do? $f = 1; for ($i=1; $i<=5; $i++) { $f = $f * $i; } echo(“f=“. $f. “ \n”);

Self-test: for(;;) {…} Countdown Write a program that displays 10,9,8,…1 Blast Off! using a for loop.

function xyz() {…} Example: function xyz($arg1,$arg2,$arg3) { $answer = ($arg1+$arg2) / $arg3; return ($answer); } //calling the function… $r = xyz(1,2,3); print($r);

Self-test: function xyz() {…} weekdayName() Write a function returns the name of the week depending on the argument passed, for example: If 0 is passed, print “Sunday” If 1 is passed, print “Monday” … If 6 is passed, print “Saturday” Call this function with each day of the week and display the return value.

Summary This Module summarizes most of PHP ’s main elements: Check out some code Read blogs and forums Practice and experiment