Server-Side Application and Data Management IT IS 3105 (Spring 2010)

Slides:



Advertisements
Similar presentations
Introduction to PHP Dr. Charles Severance
Advertisements

Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
IST 221 Internet Concepts and Applications Introduction to PHP.
Outline Java program structure Basic program elements
PHP Server-side Programming. PHP  PHP stands for PHP: Hypertext Preprocessor  PHP is interpreted  PHP code is embedded into HTML code  interpreter.
PHP Scripting Language. Introduction “PHP” is an acronym for “PHP: Hypertext Preprocessor.” It is an interpreted, server-side scripting language. Originally.
1 CS428 Web Engineering Lecture 18 Introduction (PHP - I)
Introduction to PHP. PHP PHP is the Hypertext Pre-processor –Script language –Embedded into HTML –Runs as Apache module –Can use DB (MySQL, Oracle, Microsoft.
August Chapter 1 - Essential PHP spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science and Technology.
CSC 318 WEB APPLICATION DEVELOPMENT.  Introduction to Server Scripting language  Client VS Server  Introduction to PHP  PHP Files and Syntax  Function.
Copyright © Curt Hill PhP History and Introduction.
Chapter 4 – The Building Blocks Data Types Literals Variables Constants.
An Introduction to PHP The University of Tennessee at Chattanooga C. Daniel Chase “An introduction to basic PHP use with a focus on the power of dynamic.
1 Identifiers  Identifiers are the words a programmer uses in a program  An identifier can be made up of letters, digits, the underscore character (
Java: Chapter 1 Computer Systems Computer Programming II.
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
School of Computing and Information Systems CS 371 Web Application Programming PHP - Basics Serving up web pages.
Nael Alian Introduction to PHP
Chap 3 – PHP Quick Start COMP RL Professor Mattos.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Fundamentals (Comments, Variables, etc.)
The Java Programming Language
C Derived Languages C is the base upon which many build C++ conventions also influence others *SmallTalk is where most OOP comes Java and Javascript have.
PHP By Sergio Rodriguez By Sergio Rodriguez. PHP G PHP: Hypertext Preprocessor G Scripting language G PHP: Hypertext Preprocessor G Scripting language.
Introduction to PHP A user navigates in her browser to a page that ends with a.php extension The request is sent to a web server, which directs the request.
Chapter 2: Java Fundamentals
PHP Teresa Worner. What is it? PHP: Hypertext Preprocessor server-side scripting language open source cross-platform compatible with almost all servers.php.php3.phtml.
Introduction to PHP Advanced Database System Lab no.1.
Introduction to Web Programming. Introduction to PHP What is PHP? What is a PHP File? What is MySQL? Why PHP? Where to Start?
CS 4720 Dynamic Web Applications CS 4720 – Web & Mobile Systems.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
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.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP Basics.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
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.
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,
By bscshelp.com 1.  It is a group assignment.  Complete Website design Using Html and Css.  Due date: 10 th December, 2014 (Hard Deadline) 2.
Outline  XAMPP  XAMPP Install  Put php and HTML documents  Windows and Mac Version  Security.
PHP using MySQL Database for Web Development (part II)
Web Database Programming Using PHP
Lecture 2: Intro to PHP What is PHP?
CS 371 Web Application Programming
Web Database Programming Using PHP
Introduction to PHP Dr. Charles Severance
DBW - PHP DBW2017.
Introduction to PHP Dr. Charles Severance
CSE 190D, Winter 2013 Building Java Programs Chapter 1
Introduction to Web programming
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
University of Central Florida COP 3330 Object Oriented Programming
PHP / MySQL Introduction
PHP Introduction.
Intro to PHP & Variables
JavaScript an introduction.
null, true, and false are also reserved.
WEB PROGRAMMING JavaScript.
Introduction to Java Programming
An overview of Java, Data types and variables
Chapter 1: Computer Systems
FMI-PLOVDIV Web Dynamic Applications
PHP.
Intro to PHP.
Focus of the Course Object-Oriented Software Development
Tutorial 6 PHP & MySQL Li Xu
Module 2 - Part 1 Variables, Assignment, and Data Types
Tutorial 10: Programming with javascript
PHP an introduction.
Chap 2. Identifiers, Keywords, and Types
PHP Language Basics.
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Presentation transcript:

Server-Side Application and Data Management IT IS 3105 (Spring 2010) Lecture 3

What is PHP? http://theopensourcery.com/phpover.htm Server-side interpreter which is Open Source and free Growing number of PHP web applications Start at PHP Resources Provides familiar syntax to C, Perl and Java developers Fast connections to popular databases Fast native connections to the Open Source MySQL database Runs reliably on Windows, Linux and Mac servers and clients Web pages run reliably on all the popular browsers Associative arrays are very useful for UI and database apps Object oriented classes are easy to understand Links to PDF, SWF, XML, Java, etc, etc.

Home site: HOME Site: Stats http://www.php.net/ Usage: http://www.php.net/usage.php

XAMPP In my examples XAMPP has been installed in: Apache root: c:\xampp Apache root: C:\xampp\htdocs http://localhost directed to the Apache root Put web files into the Apache root

Testing PHP php –v XAMPP in Windows If php is installed and configured it will return the version number XAMPP in Windows Sets environment Run from “shell”

Testing apache/php http://localhost Create simple test webpage: Will show XAMPP home page Uses the “magic” of the index.php default Create simple test webpage: Figure 1-2 on page 7 of Spring into PHP5 Save in c:/xampp/htdocs as ajktest1.php Default root for XAMPP Apache install http://localhost/phpbooksexamples/ch01/phphtml.php Mixture of HTML and PHP Will display php installation information

Mixing HTML and PHP Can mix HTML and php code! Source: to view: c:\xampp\htdocs\PHPBookExamples\ch01\phphtml.php to view: http://localhost/PHPBookExamples/ch01/phphtml.php

Some php Basics Interpreted Language All commands must be terminated with a “;” Contrast that to JavaScript Weakly typed language Data is interpreted for best type Programmer must use care in storing and retrieving data

Printing ECHO... ECHO... ECHO... ECHO... ECHO... Sends the quoted text to the stdout echo “This is a test”;

Special Print Characters (escape sequences) \n Newline \r Carriage return \t Tab \\ Prints a \ \$ Prints a $ \” Prints a “ \0 to \777 Prints a character based on the octal value \x0 to \xFF Prints a character based on the hexadecimal value

Quote notes Single and Double quote have similar but different uses: Single Quotes: “ ' “ Literal storage of the string Double Quotes: “ " “ Allows “interpretation” escape sequences values for imbedded variables (eg. $value)

Command line php can be used from a command line Must be in a “path” or in the directory Windows XAMPP: Use the Shell button to set environment

Comments Scripts must be maintainable!!!! Single line: // or # Use comments to document the code Single line: // or # echo “test1”; echo “test2”; // this is a comment echo “test3”; # this is another comment One or more lines: /* … */ echo “test2”; /* this starts a comment that continues on the next line and ends here */ echo “test3”;

Variables - Names Variables Begin with a $ Second character may be: a letter - or - an underscore Third and following characters may be: letters numbers underscores No practical length restriction

Variables - Types php is a weakly typed language Do not need to declare variable type Programmers responsibility to put and retrieve the correct type of data php will convert data types as needed

Variables - Assigning Basic assignment operator is the = $var1 = 255; // var1 is an integer $var2 = “Test”; // var2 is a string $var3 = 3.1; // var3 is a float $var4 = TRUE; // var4 is a boolean

Variables: Interpolating Interpolating variables in string php will replace variables in strings with their values String must be in double quotes Example $dogs = 2; echo “There are $dogs in the yard.”; Curly braces will allow the variable to be parsed and placed exactly in text (no spaces)

Variable variables Variables may contain the name of variables! Use $$varname to access To use: Declare your variables $dogname = “Fido”; $catname = “Felix”; Assign variable name to your “variable variable” $petname = “dogname”; Use the “variable variable” – note the use of $$ echo “Your pet name is “, $$petname; Example: ajkExamples/ch01/varvar.php

Constants php makes creating constants easy: define() define(“pi”, 3.14159); define(“fname”, “Jack”); define(“lname”, “Spratt”);

Keywords endif endswitch endwhile extends final (as of PHP 5) for PHP Keywords abstract (as of PHP 5) and array() as break case catch cfunction (PHP 4 only) class clone const continue declare default do else elseif enddeclare endfor endforeach namespace (as of PHP 5.3) new old_function (PHP 4 only) or private (as of PHP 5) protected public static switch throw try use var while xor endif endswitch endwhile extends final (as of PHP 5) for foreach function global goto (as of PHP 5.3) if implements interface instanceof

Keywords Compile-time constants Language constructs die() __CLASS__ __DIR__ (as of PHP 5.3) __FILE__ __FUNCTION__ __METHOD__ __NAMESPACE__ Language constructs die() echo() empty() exit() eval() include() include_once() isset() list() require() require_once() return() print() unset()

Data Types Boolean Integer Float String Array Object Resourse NULL