INLS 623 – D ATABASE A PPLICATION D EVELOPMENT AND I NTERNET A PPLICATIONS Instructor: Jason Carter.

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

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
PHP syntax basics. Personal Home Page This is a Hypertext processor It works on the server side It demands a Web-server to be installed.
Introduction to PHP MIS 3501, Fall 2014 Jeremy Shafer
Multiple Tiers in Action
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
David Evans CS200: Computer Science University of Virginia Computer Science Class 29: Vocational Skills How to Build a.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
PHP: Introduction By Trevor Adams.
+ Connecting to the Web Week 7, Lecture A. + Midterm Basics Thursday February 28 during Class The lab Tuesday, February 26 is optional review Class on.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
ALBERT WAVERING BOBBY SENG. Week Whatever: PHP  Announcements/questions/complaints.
INLS 623– T HREE T IERED A RCHITECTURES Instructor: Jason Carter.
INLS 560 – V ARIABLES, E XPRESSIONS, AND S TATEMENTS Instructor: Jason Carter.
Application Development Description and exemplification of server-side scripting language for server connection, database selection, execution of SQL queries.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
© Yanbu University College YANBU UNIVERSITY COLLEGE Management Science Department © Yanbu University College Module 6:WEB SERVER AND SERVER SIDE SCRPTING,
INLS 623 – D ATABASE A PPLICATION D EVELOPMENT AND I NTERNET A PPLICATIONS Instructor: Jason Carter.
INTERNET APPLICATION DEVELOPMENT For More visit:
Create an online booking system (login/registration)
Server-side Scripting Powering the webs favourite services.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
1 Accelerated Web Development Course JavaScript and Client side programming Day 2 Rich Roth On The Net
HTML. Principle of Programming  Interface with PC 2 English Japanese Chinese Machine Code Compiler / Interpreter C++ Perl Assembler Machine Code.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
School of Computing and Information Systems CS 371 Web Application Programming PHP – Forms, Cookies, Sessions and Database.
Dynamic web content HTTP and HTML: Berners-Lee’s Basics.
INLS 623– S TORED P ROCEDURES Instructor: Jason Carter.
הרצאה 4. עיבוד של דף אינטרנט דינמי מתוך Murach’s PHP and MySQL by Joel Murach and Ray Harris.  דף אינטרנט דינמי משתנה עפ " י הרצת קוד על השרת, יכול להשתנות.
Creating A Database Driven Website 1.Setting Up Your Web Server 2.Creating a Database 3.Creating a Webpage to Display Information From a Database 4.Creating.
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.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
PHP: MySQL. PHP Connect to MySQL PHP 5 and later can work with a MySQL database using: – MySQLi extension (the "i" stands for improved) – PDO (PHP Data.
PHP Database Pemrograman Internet. PHP MySQL Database With PHP, you can connect to and manipulate databases. MySQL is the most popular database system.
CHAPTER 10 PHP MySQL Database
1) PHP – Personal Home Page Scripting Language 2) JavaScript.
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
1 PHP HTTP After this lecture, you should be able to know: How to create and process web forms with HTML and PHP. How to create and process web forms with.
Higher Computing Science Coding the Web: HTML, JavaScript, PHP and MySQL.
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.
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.
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 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.
Web Systems & Technologies
Web Database Programming Using PHP
INLS 623– Stored Procedures
Introduction to Dynamic Web Programming
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Web Database Programming Using PHP
Web Design and Development
Chapter 19 PHP Part III Credits: Parts of the slides are based on slides created by textbook authors, P.J. Deitel and H. M. Deitel by Prentice Hall ©
Introduction to Web programming
PHP / MySQL Introduction
PHP Introduction.
ISC440: Web Programming 2 Server-side Scripting PHP 3
Introduction to Web programming
PHP.
Web DB Programming: PHP
PHP and Forms.
PHP: Combo box FdSc Module 109 Server side scripting and
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
Tutorial 6 PHP & MySQL Li Xu
Introduction to Web programming
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:

INLS 623 – D ATABASE A PPLICATION D EVELOPMENT AND I NTERNET A PPLICATIONS Instructor: Jason Carter

W HY I NTERNET A PPLICATIONS ? SQL is a query language; as such it has limitations Typical programming languages support: Complex computation on data Specialized user interfaces. Logic and decision making. Access to more than one database at a time

I NTERNET HTML CSS JavaScript AJAX Cookies HTTP Request ResponseGET POST Redirect PHPSQL Java ASP.NET Python

I NTERNET HTML CSS JavaScript AJAX Cookies HTTP Request ResponseGET POST Redirect PHPSQL Java ASP.NET Python Client Server

HTTP The HyperText Transport Protocol is the set of rules to allow browsers to retrieve web documents from servers over the Internet

HTTP - H YPERTEXT T RANSPORT P ROTOCOL The dominant Application Layer Protocol on the Internet Invented for the Web - to Retrieve HTML, Images, Documents etc. Extended to be data in addition to documents - RSS, Web Services, etc.. Basic Concept - Make a Connection - Request a document - Retrieve the Document - Close the Connection

I NTERNET HTML CSS JavaScript AJAX Cookies HTTP Request ResponseGET POST Redirect PHPSQL Java ASP.NET Python Client Server

protocolhostdocument C LIENT

C LIENT /S ERVER Client Server

C LIENT /S ERVER Client Server Click

C LIENT /S ERVER Client Server Click GET Request

C LIENT /S ERVER Client Server Click GET Request The Second Page If you like, you can switch back to the First Page. Response

C LIENT /S ERVER Client Server Click GET Request The Second Page If you like, you can switch back to the First Page. Response

Browser Web Server Database Server Apache PHP MySql

W HY PHP? Easy to learn MySQL is built into PHP PHP allows you to connect to and manipulate mysql databases. Works great with HTML PHP and HTML are interchangeable

PHP PHP: Personal Home Page PHP: Hypertext Preprocessor

Hello from Dr. Chuck's HTML Page <?php echo "Hi there.\n"; $answer = 6 * 7; echo "The answer is $answer, what "; echo "was the question again?\n"; ?> Yes another paragraph. S AMPLE PHP

Hello from Dr. Chuck's HTML Page <?php echo "Hi there.\n"; $answer = 6 * 7; echo "The answer is $answer, what "; echo "was the question again?\n"; ?> Yes another paragraph. S AMPLE PHP

I NTERPRETED L ANGUAGES Interpreter reads code and performs operations one line at a time. PHP Interpeter Machine Language

V ARIABLES A variable is a name that refers to a value A name that represents a value stored in the computer memory Dollar signs to start variable names $age Assignment statement: used to create a variable and make it reference data General format is variable = expression Example: $age = 29 Assignment operator: the equal sign (=)

A SSIGNMENT S TATEMENT In an assignment statement, variable receiving value must be on left side You can only use a variable if a value is assigned to it $message = "What’s up, Doc?”; $n = 17; $pi = ;

S TATEMENT A statement is an instruction that the PHP interpreter can execute echo “1”; $x = 2; echo $x; Output: 1 2 The assignment statement does not produce output. All statements must end with a semicolon ( ; )

E XPRESSIONS

A combination of values, variables, and operators Operators are special symbols that represent computations Addition+ Subtraction- Multiplication* Division/ Reminder (Modulus)% Performs division and returns the reminder 4%2 = 0 5%2 = 1

O RDER OF O PERATIONS Follows same rule of precedence as mathematics PEMDAS Parentheses Exponentiation Multiplication and Division Addition and Subtraction Evaluate the expression: (4 + 4) - 3

PHP A RRAYS AND M Y SQL Stores items in a sequence one after another Stores multiple values in a single variable PHP retrieves records from a MySQL database table and stores them in an array Stores multiple values in a single variable

P HILOSOPHY OF PHP You are a responsible and intelligent programmer You know what you want to do Lets make this as convenient as possible Sometimes errors fail silently

C ONNECTING TO M Y SQL <?php $servername = "pearl.ils.unc.edu"; $username = "db2_1"; $password = "hw3Mk4xgT"; $dbname = "db2_1"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: ". $conn->connect_error); } ?>

S ELECTING FROM A TABLE <?php $servername = " pearl.ils.unc.edu"; $username = " db2_1"; $password = " hw3Mk4xgT"; $dbname = ” db2_1"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: ". $conn->connect_error); $sql = "select * from people"; $result = $conn->query($sql); } ?>

<?php $servername = "localhost"; $username = "root"; $password = "root"; $dbname = ”classicmodels"; // Create connection $conn = new mysqli($servername, $username,$password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: ". $conn->connect_error); $sql = "select * from customers"; $result = $conn->query($sql); //if the number of rows are greater than 0 if ($result->num_rows > 0) { //while there are rows while($row = $result->fetch_assoc()) { echo $row[’pid']." ".$row[‘first_name']." ".$row[’last_name']." ".$row[’user_name']; echo " "; echo " ”; } //close the connection mysqli_close($conn); ?>

C ONNECTING TO M Y SQL <?php $servername = "pearl.ils.unc.edu"; $username = "db2_1"; $password = "hw3Mk4xgT"; $dbname = "db2_1"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: ". $conn->connect_error); } ?>

I NSERTING D ATA <?php //variables that will be inserted into the database $courseNumber= 123; $sectionNumber = 23; $name= ”Databases III"; ?>

<?php $sql = "insert into course (courseNumber, sectionNumber, name) values ($courseNumber,$sectionNumber, '$name')"; //execute the query result = $conn->query($sql); ?>

<?php if($result) { echo "New record created successfully"; } else { echo "Error: ". $sql. " ". mysqli_error($conn); } mysqli_close($conn); ?>

I NSERTING D YNAMIC D ATA Use HTML forms to collect data Form tags contain html elements There are many html elements Input Text Radio submit

I NPUT T EXT T AGS First name: Last name:

I NPUT S UBMIT T AG First name: Last name:

S UBMIT Sends the values of the input tag (not the submit button) to the server The action tag determines which file processes the values from the input tag How?

P ASS VALUES TO S ERVER /PHP GET (default) form submission is passive (like a search engine query), and without sensitive information GET is best suited to short amounts of data. Size limitations are set in your browser action_page.php?firstname=Mickey&lastname=Mouse

P ASS V ALUES TO S ERVER /PHP POST form is updating data, or includes sensitive information (password) POST offers better security because the submitted data is not visible in the page address

H OW DOES PHP G ET T HE V ALUES ? Superglobals Built in variables that are available at all scopes $GLOBALS $_SERVER $_REQUEST $_POST $_GET $_FILES $_ENV $_COOKIE $_SESSION

PHP $_POST Collects form data after submitting the HTML from using post <form action="action_page.php” method = “POST”> First name: Last name: <input type="submit" value="Submit"> echo $_POST[‘firstname’]; echo $_POST[‘’lastname’];

PHP $_GET Collects form data after submitting the HTML from using post <form action="action_page.php” method = “GET”> First name: Last name: <input type="submit" value="Submit"> echo $GET[‘firstname’]; echo $GET[‘’lastname’];

P RACTICE /H OMEWORK Look at homework

P RACTICE /H OMEWORK