IS1500: Introduction to Web Development

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

Creating WordPress Websites. Creating a site on your computer Local server Local WordPress installation Setting Up Dreamweaver.
Web Page A page displayed by the browser. Website Collection of multiple web pages Web Browser: A software that displays web pages on client computer.
© Yanbu University College YANBU UNIVERSITY COLLEGE Management Science Department © Yanbu University College Module 6:WEB SERVER AND SERVER SIDE SCRPTING,
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
INFM 603: Information Technology and Organizational Context Jimmy Lin The iSchool University of Maryland Thursday, October 18, 2012 Session 7: PHP.
INTERNET APPLICATION DEVELOPMENT For More visit:
Server-side Scripting Powering the webs favourite services.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
Introduction to MySQL Lab no. 10 Advance Database Management System.
PHP MySQL Introduction. MySQL is the most popular open-source database system. What is MySQL? MySQL is a database. The data in MySQL is stored in database.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Technology & Management Club Development Software Overview.
CHAPTER 7 Form & PHP. Introduction All of the following examples in this section will require two web pages. The first page retrieves information posted.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
GOAL User Interactive Web Interface Update Pages by Club Officers Two Level of Authentication.
Web Architecture Introduction
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.
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
Microsoft FrontPage 2003 Illustrated Complete Integrating a Database with a Web Site.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
CITA 310 Section 7 Installing and Testing a Programming Environment (Textbook Chapter 7)
MySQL. Is a SQL (Structured Query Language) database server. Can be accessed using PHP with embedded SQL Queries Supports Large DB’s, 60,000 tables with.
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
MySQL MySQL and PHP – interacting with a database.
13 – PHP MySQL Connection Informatics Department Parahyangan Catholic University.
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.
Chapter 1 Getting Started with ASP.NET Objectives Why ASP? To get familiar with our IDE (Integrated Development Environment ), Visual Studio. Understand.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
Web Systems & Technologies
PHP Basics and Syntax Lesson 3 ITBS2203 E-Commerce for IT.
PHP using MySQL Database for Web Development (part II)
2nd year Computer Science & Engineer
PHP: MySQL Lecture 14 Kanida Sinmai
Web Technologies Computing Science Thompson Rivers University
IS1500: Introduction to Web Development
Introduction to Dynamic Web Programming
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Introduction to web development concepts
Session 4 PHP & MySQL.
Web Design and Development
Server-Side Application and Data Management IT IS 3105 (Spring 2010)
Introduction to Web programming
PHP / MySQL Introduction
PHP Introduction.
Website Development Basics with PHP MySQL
PHP: Output Formatting
Database Driven Websites
ISC440: Web Programming 2 Server-side Scripting PHP 3
Login & administration page
Chapter 8 Working with Databases and MySQL
Introduction to Web programming
Web Browser server client 3-Tier Architecture Apache web server PHP
MySQL Web Application Connecting to a MySQL database
CIS 388 Internet Programming
IntroductionToPHP Static vs. Dynamic websites
Tutorial 6 PHP & MySQL Li Xu
MySQL Web Application Connecting to a MySQL database
Web Technologies Computing Science Thompson Rivers University
Client-Server Model: Requesting a Web Page
Introduction to Web programming
Conection
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:

IS1500: Introduction to Web Development Dynamic Websites with PHP Martin Schedlbauer, Ph.D. m.schedlbauer@neu.edu

Dynamic Websites with PHP IS4300 Dynamic Websites Websites with just content pages are called static websites. Dynamic websites collect data and display pages that are generated right before being sent to the browser. IS1500 Dynamic Websites with PHP

Example of a Static Website Adding additional players requires that a web developer modify the page and then republish the page. This is time consuming, error prone, and expensive. IS1500 Dynamic Websites with PHP

Better Approach: Dynamic Pages Why not put the information into a database and then write code to extract the information and build a page programmatically? Then, to modify the page, only add additional data to the database. IS1500 Dynamic Websites with PHP

Dynamic Page Generation From http://blog.search3w.com/dynamic-to-static/hello-world/ IS1500 Dynamic Websites with PHP

Dynamic Websites with PHP Scripting Engines There are several server-side scripting engines that use different programming languages: PHP as the scripting language accessing data from a relational database, most commonly MySQL Ruby on Rails using MySQL ASP.NET using SQL Server or Microsoft Access IS1500 Dynamic Websites with PHP

Common Technology Stacks LAMP/WAMP: Linux or Windows as the server operating system Apache as the web server MySQL as the database PHP as the dynamic page scripting language IS1500 Dynamic Websites with PHP

Dynamic Websites with PHP Our Stack We are using a simplified stack requiring less programming experience: Hosted server (AwardSpace/Weebly) Hosted web development platform (AwardSapce) Database (MySQL) Dynamic page scripting language (PHP) IS1500 Dynamic Websites with PHP

Dynamic Page Generation in PHP Internet Generated HTML PHP Program HTML + PHP Script Database Browser IS1500 Dynamic Websites with PHP

Data: Definition & Generation A database is a collection of tables containing records each of which has fields. The MySQL database is a “relational database”. Administration is done through the PHPAdmin3 web tool. IS1500 Dynamic Websites with PHP

Steps for Creating Dynamic Pages create a database define tables for the database add data to the database or build a form that collects data and stores it in the tables write PHP program to build HTML page with data from database integrate PHP program into website IS1500 Dynamic Websites with PHP

Dynamic Websites with PHP Step 4: The PHP Program <?php $servername = "pdb18.awardspace.net"; $username = "1236683_bruins"; $password = "4BostonBruins"; $database = "1236683_bruins"; $port = "3306"; // Create connection $conn = mysqli_connect($servername, $username, $password, $database, $port); // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } $sql = "SELECT * FROM players"; $result = $conn->query($sql); if ($result->num_rows > 0) { // create table structure echo "<table border=0>"; // output data of each row: a single player with picture and name while($row = $result->fetch_assoc()) { echo "<tr>"; echo "<td><img src='" . $row["p_image"] . "' width=100 height=120/></td>"; echo "<td valign=top style='color:darkgray'>"; echo $row["p_name"]. " (" . $row["p_pos"]. ")</td>"; echo "</tr>"; echo "</table>"; } else { echo "0 results"; ?> IS1500 Dynamic Websites with PHP

PHP: Connecting to the Database $servername = "pdb18.awardspace.net"; $username = "1236683_bruins"; $password = "4BostonBruins"; $database = "1236683_bruins"; $port = "3306"; // Create connection $conn = mysqli_connect($servername, $username, $password, $database, $port); // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } IS1500 Dynamic Websites with PHP

PHP: Retrieving Data with SQL $sql = "SELECT * FROM players"; $result = $conn->query($sql); This is the name of the table you created in the MySQL database. Look at the table names using PHPAdmin3 IS1500 Dynamic Websites with PHP

PHP: Displaying the Data by Row if ($result->num_rows > 0) { // create table structure echo "<table border=0>"; // output data of each row: a single player with picture and name while($row = $result->fetch_assoc()) { echo "<tr>"; echo "<td><img src='" . $row["p_image"] . "' width=100 height=120/></td>"; echo "<td valign=top style='color:darkgray'>"; echo $row["p_name"]. " (" . $row["p_pos"]. ")</td>"; echo "</tr>"; } echo "</table>"; This is the name of the column you specified when you created the table. <table border=0> <tr><td><img src='http://bit.ly/1CWFXUv' width=100 height=120/></td> <td valign=top style='color:darkgray'>Tuuka Rask (Goalie)</td></tr> <tr><td><img src='http://cdn.agilitycms.com/nhlpacom/27205.jpg' width=100 height=120/></td> <td valign=top style='color:darkgray'>Patrice Bergeron (Forward)</td></tr> <tr><td><img src='https://er.cloudfront.net/465499052.jpg?ts=1425829465' width=100 height=120/></td> <td valign=top style='color:darkgray'>Brett Connolly (Forward)</td></tr> </table> IS1500 Dynamic Websites with PHP

Dynamic Pages in Summary IS4300 Dynamic Pages in Summary MySQL Database 1. define database 3. Retrieve data and generate dynamic page via script 2. add data to database IS1500 Dynamic Websites with PHP

Dynamic Websites with PHP Embedding into HTML The simplest way is to add the URL as embedded <iframe> HTML tag: <iframe src="http://is1500-mysql-sandbox.boatventures.us/loadPlayers.php" width='100%'> </iframe> IS1500 Dynamic Websites with PHP

Dynamic Websites with PHP Database Checklist Tables name should not contain spaces Column names should not contain spaces Ensure that every table has a primary key which is generally a numeric ID field IS1500 Dynamic Websites with PHP

Summary, Review, & Questions… IS1500 Dynamic Websites with PHP