PHP and SQL Server: Queries IST2101. Steps to Design PHP Pages to Answer User Queries 1.Query generation – What SQL query do we need to retrieve the desired.

Slides:



Advertisements
Similar presentations
PHP I.
Advertisements

SQL-week5-1 In-Class Exercise Answer IST 210 Organization of Data IST2101.
Keys, Referential Integrity and PHP One to Many on the Web.
11 Getting Started with ASP.NET Beginning ASP.NET 4.0 in C# 2010 Chapters 5 and 6.
HTML Form and PHP IST Review of Previous Class HTML table and PHP array Winner is chosen automatically using rand() function.
U:/msu/course/cse/103 Day 23, Slide 1 Review of Day 22 What query did you use to search for an actor by name? –Return matches.
Website Development & Management PHP Odds & Ends Instructor: John Seydel, Ph.D. CIT Fall
Sara SartoliAkbar Siami Namin NSF-SFS workshop July 14-18, 2014.
PHP and SQL Server: Queries IST2101. Three-Tier Architecture Three-tier architecture means that the Web server and the DBMS are on separate servers IST2102.
SQL for Data Retrieval. Save your SQL Scripts When working with SQL Management Studio, you should keep saving your scripts as a.sql file to somewhere.
Database Updates Made Easy In WebFocus Using SQL And HTML Painter Sept 2011 Lender Processing Services 1.
PHP and SQL Server: Queries IST2101. Project Report 4 SQL Queries Due Sunday, 4/5 at 11:59pm Instructions on how to access team webspace and SQL database.
SQL for Data Retrieval. Running Example IST2102 Data Preparation Login to SQL server using your account Download three SQL script files from wiki page.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Dataface API Essentials Steve Hannah Web Lite Solutions Corp.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
Application Development Description and exemplification of server-side scripting language for server connection, database selection, execution of SQL queries.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
U:/msu/course/cse/103 Day 25, Slide 1 Back-up PHP Files If you have not yet passed the 3.0 BT, make back-up copies of ALL.
INTERNET APPLICATION DEVELOPMENT For More visit:
1 Insert, Update and Delete Queries. 2 Return to you Address Book database. Insert a record.
Server-side Scripting Powering the webs favourite services.
SQL HW1 Turn in as a hardcopy at the start of next class period. You may work this assignment in groups.
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Software Engineering 2003 Jyrki Nummenmaa 1 CASE Tools CASE = Computer-Aided Software Engineering A set of tools to (optimally) assist in each.
WRA INTRODUCTION TO WEB AUTHORING. HELLO, MY NAME IS: JOHN Basics Former PW Alum Really like tv, video games, and MSU sports and the Tigers.
IST 210: PHP BASICS IST 210: Organization of Data IST210 1.
PHP meets MySQL.
1 Data Bound Controls II Chapter Objectives You will be able to Use a Data Source control to get data from a SQL database and make it available.
Universiti Utara Malaysia Chapter 3 Introduction to ASP.NET 3.5.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
Accessing MySQL with PHP IDIA 618 Fall 2014 Bridget M. Blodgett.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Homework #4 HTML Web Assignment II ©2001 E. Kinnear.
PHP+MySQL Integration. Connecting to databases One of the most common tasks when working with dynamic webpages is connecting to a database which holds.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
HTML Table and PHP Array
HTML FORMS GET/POST METHODS. HTML FORMS HTML Forms HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes,
HTML Form and PHP IST Review of Previous Class HTML table and PHP array Winner is chosen randomly using rand() function.
Programming Assignment 3 Add forms in your web page so that visitors can add a comment about your web page – Example:
CHAPTER 7 Form & PHP. Introduction All of the following examples in this section will require two web pages. The first page retrieves information posted.
+ Introduction to Class IST210 Class Lecture. + Course Objectives Understand the importance of data, databases, and database management Design and implement.
Creating PHPs to Insert, Update, and Delete Data CS 320.
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
SQL for Data Retrieval. Running Example IST2102 Data Preparation Login to SQL server using your account Select your database – Your database name is.
Level 1 Tutorial Project How to put a movie player on your Weebly website using an HTML code.
STRUCTURED QUERY LANGUAGE SQL-II IST 210 Organization of Data IST210 1.
STRUCTURED QUERY LANGUAGE SQL-III IST 210 Organization of Data IST210 1.
SQL for Data Retrieval. Save your SQL Scripts When working with SQL Management Studio, you should keep saving your scripts as a.sql file to somewhere.
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.
Exercise 1: IF/ELSE Step 1: Open NotePad++ and create “number.php” in your webspace Step 2: Write codes to do the following 1.Generate a random number.
PHP and SQL Server: Connection IST2101. Typical web application interaction (php, jsp…) database drivers 2IST210.
SQL-5 In-Class Exercise Answer IST 210 Organization of Data IST2101.
A Simple Website using Cascading Style Sheets (CSS) IST2101.
MGS 351 Introduction to Management Information Systems RECITATION 12.
Database Access Control IST2101. Why Implementing User Authentication? Remove a lot of redundancies in duplicate inputs of database information – Your.
>> PHP: File Uploads. Pre-requisite Go Online – Download file modify-item.php – copy it to your root folder (D:\xampp\htdocs\Buy4mMe) Web-Based Systems.
ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#.
HTML FORM Lab Exercise IST Guideline Add forms in your web page so that visitors can add a comment about your web page Forms should include the.
HTML FORM AND PHP IST 210: Organization of Data IST210 1.
Form Data (part 2) MIS 3502, Fall 2015 Brad N Greenwood, PhD Department of MIS Fox School of Business Temple University 11/10/2015 Slide 1.
PHP AND SQL SERVER: QUERIES IST 210: Organization of Data IST210 1.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
PHP Array and HTML Table IST 210 Organization of Data IST2101.
A Simple Website using Cascading Style Sheets (CSS) IST2101.
DATABASE ACCESS CONTROL IST Question Almost every PHP page needs to interact with database, does that mean sqlUsername and sqlPassword need to be.
PHP and SQL Server: Connection IST 210: Organization of Data IST2101.
PHP AND SQL SERVER: CONNECTION IST 210: Organization of Data IST210 1.
>> PHP: Update Query
Presentation transcript:

PHP and SQL Server: Queries IST2101

Steps to Design PHP Pages to Answer User Queries 1.Query generation – What SQL query do we need to retrieve the desired information? 2.HTML form design – What form element(s) are most suitable for user input in this case? 3.Query processing and result display – How to query the database and display the results using PHP?

Example: Case 4 I want a website to show me the information of all projects which are assigned to one or more specific employees User input example: 1 - Mary Jacobs 5 - Heather Jones

Step 1: Query Generation Write SQL query to show the projects which are assigned to employees 1-Mary Jacobs and 5-Heather Jones

Step 1: Query Generation Write SQL query to show the projects which are assigned to employees 1-Mary Jacobs and 5-Heather Jones SELECT * FROM PROJECT WHERE ProjectID IN (SELECT ProjectID FROM ASSIGNMENT WHERE EmployeeNumber IN (1,5));

Step 2: HTML Form Design Is the following design appropriate? I want a website to show me the information of all projects which are assigned to one or more specific employees Problems: 1.Users may not know which employees are in the database 2.Users may not know what information is needed (employee number, or employee name, or both?)

Step 2: HTML Form Design Solution: When possible, give users a list of options to choose from Is the following design appropriate? I want a website to show me the information of all projects which are assigned to one or more specific employees Problem: Selection of more than one employee is not allowed.

Step 2: HTML Form Design Solution: Using checkboxes Is the following design appropriate? I want a website to show me the information of all projects which are assigned to one or more specific employees

Step 2: Code Specification IST2109 case4.php Retrieve the IDs and names of all employees from database Use the “while loop” to generate a checkbox for each employee Name of the array which stores the user’s choices Value that will be passed to the process page Value shown on the webpage

Step 3: Query Processing process_case4.php This is the SQL Query we wrote in Step 1. Employee numbers are obtained from user input

Case 4. Try it yourself Download the case4.php and process_case4.php from course website. Open case4.php and process_case4.php from NotePad++ and add your database information to both files IST21011 Input your own information

Case 4. Try it yourself (cont’d) Visit the php page to query your database – IST21012

In-class Exercise: Case 5 Create PHP webpages to show the information of all employees which are assigned to one or more specific projects –

Step 1: Query Generation Write SQL query to show the employees which are assigned to projects with ID 2 and 3. Execute the query in SQL Management Studio to make sure you retrieve the desired result

Step 2: HTML Form Design Create case5.php in your webspace, copy from case4.php and modify it IST21015 Action to which PHP page?

Step 2: HTML Form Design (cont’d) Modify your case5.php IST21016 Modify this query to retrieve all projects instead of employees Modify these lines to display all the projects using checkboxes

Step 3: Query Processing Create process_case5.php, copy from process_case4.php and modify it IST21017 What ID should you use now? Put the SQL Query you wrote in Step 1 here. The IDs are obtained from user input.