NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
1 PHP Statement Constructs Server Scripting. 5-2 Basic Statement All Statements end in a semicolon. Statements are delimited from the HTML code by enclosing.
NMED 3850 A Advanced Online Design February 1, 2010 V. Mahadevan.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
Tutorial 10 Programming with JavaScript
PHP Scripts HTML Forms Two-tier Software Architecture PHP Tools.
Introduction to PHP (Part-1) Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
PHP Scripts HTML Forms Two-tier Software Architecture PHP Tools.
PHP Server-side Programming. PHP  PHP stands for PHP: Hypertext Preprocessor  PHP is interpreted  PHP code is embedded into HTML code  interpreter.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 25 – Perl and CGI (Common Gateway Interface) Outline 25.1 Introduction 25.2 Perl 25.3 String Processing.
August Chapter 1 - Essential PHP spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science and Technology.
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.
PHP H ypertext P re-processor. Unit 6 - PHP - Hello World! - Data types - Control structures - Operators.
MySQL in PHP – Page 1 of 17CSCI 2910 – Client/Server-Side Programming CSCI 2910 Client/Server-Side Programming Topic: MySQL in PHP Reading: Williams &
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
INTERNET APPLICATION DEVELOPMENT For More visit:
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Week 9 PHP Cookies and Session Introduction to JavaScript.
Web Design and Development for E-Business By Jensen J. Zhao Copyright 2003 Prentice Hall, Inc. Web Design and Development for E-Business Jensen J. Zhao.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
Tutorial 10 Programming with JavaScript
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
NMED 3850 A Advanced Online Design January 12, 2010 V. Mahadevan.
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.
PHP - Basic Language Constructs CSCI 297 Scripting Languages - Day Two.
Overview: 1. Discussion of the basic architecture of a web application. 2. Discussion of the relevance of using MySQL and PHP in a web application.
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
CHAPTER 9 PHP AND MYSQL. A POSSIBLE SITE CONFIGURATION Application Folder index.php includes (folder)header.phpfooter.phpstyle.cssmodel (folder)mysqli_connect.php.
Just a Little PHP Programming PHP on the Server. Common Programming Language Features Comments Data Types Variable Declarations Expressions Flow of Control.
Introduction to PHP Advanced Database System Lab no.1.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP & MySQL.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
Strings, output, quotes and comments
Server-Side Scripting with PHP ISYS 475. PHP Manual Website
PHP getting data from a MySQL database. Replacing XML as data source with MySQL Previously we obtained the data about the training session from an XML.
הרצאה 4. עיבוד של דף אינטרנט דינמי מתוך Murach’s PHP and MySQL by Joel Murach and Ray Harris.  דף אינטרנט דינמי משתנה עפ " י הרצת קוד על השרת, יכול להשתנות.
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.
CHAPTER 6 Introduction to PHP5 Part I อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
NMED 3850 A Advanced Online Design January 14, 2010 V. Mahadevan.
Just a Little PHP Programming PHP on the Server. Common Programming Language Features Comments Data Types Variable Declarations Expressions Flow of Control.
CST336, Dr. Krzysztof Pietroszek Week 2: PHP. 1.Introduction to PHP 2.Embed PHP code into an HTML web page 3.Generate (output HTML) web page using PHP.
Introduction to JavaScript CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting PHP Basics.
Chapter 1 Introduction to PHP Part 1. Textbook’s Code DOWNLOADS PHP and MySQL for Dynamic Web Sites Complete Set of Scripts.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
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.
Introduction to PHP 1.What is PHP? What Is PHP?  php: hypertext preprocessor  Server-side scripting language—like ASP—scripts are executed on server.
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.
CGS 3066: Web Programming and Design Spring 2016 PHP.
PHP using MySQL Database for Web Development (part II)
Web Database Programming Using PHP
Introduction to Dynamic Web Programming
Chapter 6 JavaScript: Introduction to Scripting
Tutorial 10 Programming with JavaScript
Introduction to PHP Part 1
Web Database Programming Using PHP
PHP (PHP: Hypertext Preprocessor)
PHP.
Web DB Programming: PHP
PHP: Database connection
Tutorial 6 PHP & MySQL Li Xu
PHP an introduction.
Web Programming and Design
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Presentation transcript:

NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan

Some PHP Fundamentals  PHP code is always written in a plain text file saved with the extension “.php”.  The web server will execute this file and return the results to the client.  Database connectivity and business logic are implemented in the PHP code.  Look and feel elements are typically implemented using Cascading Style Sheets (CSS).  CSS can be static or combined with PHP to dynamically set look and feel elements (more on this later).

PHP (cont.)  To start writing a PHP script, surround the code with: <?php // insert code here ?>  Whatever is written between the will be executed by the PHP interpreter running on the web server.  Comments are specified using // and are ignored by the PHP interpreter.

PHP (cont.)  Variables: an identifier for storing and accessing data items within a PHP script.  Variable are declared using the “$” sign and an identifier name: $var1; $var2;  Variables can be assigned values as follows: $var1 = 'hello'; $var2 = 'world'; $var3 = 1;  The keyword “echo” will print out the value of the variable.

PHP (cont.)  Remember that anything you print out (echo) using a PHP script will be rendered by the web browser, so it must be properly formatted HTML code. <?php echo ' '; echo ' Test Page '; echo ' '; $var1 = 'hello'; $var2 = 'world'; $var3 = 1; $var4 = 2; echo $var1. ' '. $var2; echo ' '; echo $var3 + $var4; echo ' '; ?>

PHP (cont.)  Variables can have different types:  Strings: sequences of text / characters  Numbers: integer, float  Boolean: TRUE, FALSE  PHP determines the type at runtime; there is no need to explicitly predefine the type.  $var1 = ‘hello’; // string type  $var2 = 1; // number (integer) type  $var3 = TRUE; // Boolean type

PHP (cont.)  PHP also has support for arrays: $array1 = array(1 => 2, 'hello' => 'world'); echo ' '; echo $array1[1]; echo ' '; echo $array1['hello']; $array1[5] = 'something'; echo ' '; echo $array1[5]; $array1[] = 'end of array'; echo ' '; echo $array1[6];

PHP (cont.)  If (expression) { // do something } else if (expression) { // do something else } else { // do something else } Expressions can be of the form: ($a == $b) // test equality ($a > $b) // test greater than

PHP (cont.)  While loops: while (expression) { // do something } do { // do something } while (expression)

PHP (cont.)  for (expression 1; expression 2; expression 3) { // do something } foreach ($array1 as $item) { // do something with $item }

PHP (cont.) <?php $hostname = 'localhost'; $username = ''; $password = ''; $connection = mysql_connect($hostname, $username, $password) or die ('Connection error!!!'); $database = 'peopledb'; mysql_select_db($database); $lastname = $_POST["last_name"]; print " Retrieved the following data from the MySQL Database based on last name = $lastname: "; $execute_statement = "SELECT * FROM person WHERE last_name='$lastname'"; $results = mysql_query($execute_statement) or die ('Error executing SQL statement!!!'); while($item = mysql_fetch_array($results)) {

PHP (cont.) print $item['last_name']; print " "; print $item['first_name']; print " "; print $item['age']; print " "; } ?>

Lab  Write 2 PHP scripts:  1. This script should generate a web page with a color background and text of various sizes / styles.  2. This script should read a database table and output the data using a HTML table.