PHP Overview PHP: Hypertext Preprocessor Server-Side Scripting

Slides:



Advertisements
Similar presentations
PHP SQL. Connection code:- mysql_connect("server", "username", "password"); Connect to the Database Server with the authorised user and password. Eg $connect.
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
PHP Hypertext Preprocessor Information Systems 337 Prof. Harry Plantinga.
Web Database Programming Connecting Database to Web.
Server-Side vs. Client-Side Scripting Languages
B.Sc. Multimedia ComputingMedia Technologies Database Technologies.
Apache Tomcat Server – installation & use Server-side language-- use Java Server Pages Contrast Client-side languages HTML Forms Servers & Server-side.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic Server Side Web Technologies: Part 2.
Multiple Tiers in Action
Performed by:Gidi Getter Svetlana Klinovsky Supervised by:Viktor Kulikov 08/03/2009.
PHP Scripts HTML Forms Two-tier Software Architecture PHP Tools.
Website Generator for SoftLab By Yohann SABBAH & Mikael V.H Cohen -Under the supervision of Viktor Kulikov- Final Presentation 7/20/2015.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
Server- Side technologies Client-side vs. Server-side scripts PHP basic ASP.NET basic ColdFusion.
Dynamic Web Sites Chris North cs3724: HCI. Presentations matt ketner, sam altman, mike gordon Vote: UI Hall of Fame/Shame?
Intro to PHP A brief overview – Patrick Laverty. What is PHP? PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used Open Source general-purpose.
Databases and the Internet. Lecture Objectives Databases and the Internet Characteristics and Benefits of Internet Server-Side vs. Client-Side Special.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
1 Accelerated Web Development Course JavaScript and Client side programming Day 2 Rich Roth On The Net
Accessing MySQL with PHP IDIA 618 Fall 2014 Bridget M. Blodgett.
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.
Polling System Part 1 Creating PHP & MySQL Files CIS 254.
SYST Web Technologies SYST Web Technologies Databases & MySQL.
Putting it all together Dynamic Data Base Access Norman White Stern School of Business.
Creating PHPs to Insert, Update, and Delete Data CS 320.
Introduction to PHP Advanced Database System Lab no.1.
GOAL User Interactive Web Interface Update Pages by Club Officers Two Level of Authentication.
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.
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.
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.
DataFlow Diagram – Level 0
הרצאה 4. עיבוד של דף אינטרנט דינמי מתוך Murach’s PHP and MySQL by Joel Murach and Ray Harris.  דף אינטרנט דינמי משתנה עפ " י הרצת קוד על השרת, יכול להשתנות.
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
1) PHP – Personal Home Page Scripting Language 2) JavaScript.
Higher Computing Science Coding the Web: HTML, JavaScript, PHP and MySQL.
 Before you continue you should have a basic understanding of the following:  HTML  CSS  JavaScript.
PHP and SQL Server: Connection IST 210: Organization of Data IST2101.
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)
Web Database Programming Using PHP
Introduction to Dynamic Web Programming
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Introduction and Principles
18 – Web applications: Server-side code (PhP)
Web Database Programming Using PHP
PHP / MySQL Introduction
PHP Introduction.
Website Development Basics with PHP MySQL
MySQL tutorial.
Database Driven Websites
Intro to PHP at Winthrop
ISC440: Web Programming 2 Server-side Scripting PHP 3
Web Systems Development (CSC-215)
Web Systems Development (CSC-215)
CIS 388 Internet Programming
Lecture 1: Multi-tier Architecture Overview
Web DB Programming: PHP
Lecture 2 - SQL Injection
Server-Side Processing II
Introduction of Week 11 Return assignment 9-1 Collect assignment 10-1
IntroductionToPHP Static vs. Dynamic websites
Tutorial 6 PHP & MySQL Li Xu
PHP Programming Using Cloud 9 IDE.
PHP By Prof. B.A.Khivsara Note: The material to prepare this presentation has been taken from internet and are generated only for students reference and.
Web Application Development Using PHP
Presentation transcript:

PHP Overview PHP: Hypertext Preprocessor Server-Side Scripting Code also included with HTML Pre-processed on server Browser gets only HTML and client-side code More secure than JavaScript More powerful than JavaScript File access, database access, etc. Less efficient than JavaScript for interactive features Must “go back” to the server When not doing JavaScript, just refer to the behaviors we’ve seen in lab.

PHP Overview Open source software Free, users can add features E.g., phpMyAdmin, DBMS connectivity Evolving documentation (www.php.net) Competitors Active Server Pages (Microsoft) Java servlets and JSP (Sun) Cold Fusion (Macromedia)

PHP Overview Summary Secure method for Processing form data More extensive calculations, manipulations possible Selective display of database data Updates, deletions from databases Separating content from design Keeping track of information from one web page to another E-mailing information Validating users (logins, privileges, etc.) Etc.

PHP Overview Basic examples Output Variables and assignment Use of built-in functions (and php.net) User-written functions Control structures Processing form input Processing querystring input POST and GET methods Session variables

PHP Overview Two DB examples (quick look first) Try it Two DB examples (quick look first) List all customer information from database Design: Connect to the DB server Select the DB we want to use (“CS19”) Get the Customer information from the DB Display it using HTML Disconnect from the DB Note: Compare to the steps we use to directly connect to the DB using phpMyAdmin

PHP Overview Connect to the DB server and select the DB “CS19” include ("/home/ktreu/aux/common_db.inc"); $linkID = mysql_connect("localhost",$dbusername,$dbuserpassword) or die ("Could not connect: " . mysql_error()); mysql_select_db("CS19", $linkID) or die ("Unable to select db: " . mysql_error()); Notes: php delimiter, variables, including external files, error checking

PHP Overview Get the list of Customers from the DB $SQL = "SELECT * FROM Customers ORDER BY name"; $allValues = mysql_query($SQL, $linkID); if (!$allValues) { echo "Could not successfully run query ($SQL) from DB: " . mysql_error(); exit; } Notes: use of SQL, possibility of multiple links to DB server, built-in MySQL functions, error checking, contents of $allValues

PHP Overview echo "<h4>All Customers Ordered by Last Name</h4>"; echo "<TABLE BORDER=1 CELLPADDING=8>"; echo "<TR><TD><B>Customer Number</B></TD><TD><B>Name</B></TD><TD><B>Phone</B></TD>"; while ($thisValue = mysql_fetch_array($allValues)) { echo "<TR>"; echo "<TD>" . $thisValue["custnum"] . "</TD>"; echo "<TD>" . $thisValue["name"] . "</TD>"; echo "<TD>" . $thisValue["phone"] . "</TD>"; echo "</TR>"; } echo "</TABLE>"; mysql_close($linkID); ?> Notes: printing HTML, looping, accessing each record from the query one by one, closing the connection

PHP Overview What changes would be needed to get different data? List all Product information? List all products sold in March with the name of the customer who purchased them? Etc.

PHP Overview Another example (quick look) Try it Another example (quick look) List all customer information from database for a specific customer Design: Get the desired customer number from the user Connect to the DB server Select the DB we want to use (“CS19”) Get the information for the customer with the desired customer number from the DB Display it using HTML Disconnect from the DB

PHP Overview Notes: method and action attributes of the form Write a form to get the customer number <form method="post" action="listCustomersByCustnum.php"> Please enter a Customer Number: <input type="text" name="custnum" length="4" maxlength="4"> <br> <input type="submit" value="Click for Customer Info"> </form> Notes: method and action attributes of the form

PHP Overview Only two changes necessary in the PHP code $custno = $_POST['custnum']; … $SQL = "SELECT * FROM Customers WHERE custnum=$custno"; $allValues = mysql_query($SQL, $linkID); if (!$allValues) { echo "Could not successfully run query ($SQL) from DB: " . mysql_error(); exit; } Notes: Accessing the form data, using it in a query, significance of double quotes

Additions Edit Delete Insert Admin functions Other tips and tricks