Questions In the PHP script mysqltest.php :

Slides:



Advertisements
Similar presentations
PHP and MySQL Database. Connecting to MySQL Note: you need to make sure that you have MySQL software properly installed on your computer before you attempt.
Advertisements

Copyright 2004 Monash University IMS5401 Web-based Systems Development Topic 2: Elements of the Web (g) Interactivity.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
1 CSE Students: Please do not log in yet. Check-in with Brian in the back. Review Days 3 and 4 in the book. Others: Please save your work and logout.
Multiple Tiers in Action
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.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
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.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
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.
INFM 603: Information Technology and Organizational Context Jimmy Lin The iSchool University of Maryland Thursday, October 18, 2012 Session 7: PHP.
Databases From A to Boyce Codd. What is a database? It depends on your point of view. For Manovich, a database is a means of structuring information in.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
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.
Basic Web Applications 2. Search Engine Why we need search ensigns? Why we need search ensigns? –because there are hundreds of millions of pages available.
Internet Research Practice and Experience Ravi Iyer.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
Class 1Intro to Databases Goals of this class Understand the architecture behind web database applications Gain a basic understanding of what relational.
Programming using C# Joins SQL Injection Stored Procedures
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
PHP and MySQL CS How Web Site Architectures Work  User’s browser sends HTTP request.  The request may be a form where the action is to call PHP.
© Anselm Spoerri Web Design Information Visualization Course Prof. Anselm Spoerri
Website Development with PHP and MySQL Saving Data.
CHAPTER 7 Form & PHP. Introduction All of the following examples in this section will require two web pages. The first page retrieves information posted.
Creating PHPs to Insert, Update, and Delete Data CS 320.
If statements and validation. If statement In programming the if statement allows one to test certain conditions and respond differently depending on.
Case Study Dynamic Website - Three Tier Architecture
Microsoft FrontPage 2003 Illustrated Complete Integrating a Database with a Web Site.
Central Arizona Phoenix LTER Center for Environmental Studies Arizona State University Data Query Peter McCartney RDIFS Training Workshop Sevilleta LTER.
U:/msu/course/cse/103 Day 21, Slide 1 CSE 103 Makeups –If you didn’t take one over the weekend, take one TUESDAY or WEDNESDAY!
Class 1Intro to Databases Goals of this class Understand the architecture behind web database applications Gain a basic understanding of what relational.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
PART 2 INTRODUCTION TO DYNAMIC WEB CONTENT AND PHP.
Generators 101 Form Mail LAMP Bubbles & Blanks End of Course Surveys Form Mail LAMP Bubbles & Blanks End of Course Surveys.
The basics of knowing the difference CLIENT VS. SERVER.
Chap 2 – Getting Started COMP YL Professor Mattos.
How Web Database Architectures Work CPS181s April 8, 2003.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Web Database Programming Using PHP.
IMS 4212: Application Architecture and Intro to Stored Procedures 1 Dr. Lawrence West, Management Dept., University of Central Florida
CHAPTER 7 LESSON C Creating Database Reports. Lesson C Objectives  Display image data in a report  Manually create queries and data links  Create summary.
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,
Day 22, Slide 1 CSE 103 Day 22 Non-students: Please logout by 10:12. Students:
DAY 20: ACCESS CHAPTERS 5, 6, 7 Larry Reaves October 28,
PHP using MySQL Database for Web Development (part II)
Web Database Programming Using PHP
Internet/Web Databases
Group 18: Chris Hood Brett Poche
CSE 103 Day 20 Jo is out today; I’m Carl
Introduction to Dynamic Web Programming
Creating Databases Local storage. join & split
Web Database Programming Using PHP
PHP / MySQL Introduction
PHP Introduction.
PHP Overview PHP: Hypertext Preprocessor Server-Side Scripting
ISC440: Web Programming 2 Server-side Scripting PHP 3
Web Systems Development (CSC-215)
WEB PROGRAMMING JavaScript.
Web DB Programming: PHP
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
IntroductionToPHP Static vs. Dynamic websites
Debrief Homework Import data from the text file CanadianUniversities06.txt into a temporary table. What is the primary key for this table? Construct an.
Tutorial 6 PHP & MySQL Li Xu
PHP Forms and Databases.
HTML Forms What are clients? What are servers?
216 Berkey Hall 12:40pm-2:30pm Fridays
Web Application Development Using PHP
Presentation transcript:

Questions In the PHP script mysqltest.php : What PHP instructions are used to connect to the database? Where is the query entered? Which code returns the formatted results of the query?

Construct SQL with Access Modify the query that finds the actors who have played Romeo so it returns the movie in which the actor appeared as Romeo and the movie’s year of release Test the query in Access Copy the SQL into the PHP script Remove the semi-colon from the end

Differences in SQL versions Copy the file AccessSQL vs MySQL.doc from the Day 34 course AFS space to your personal space

Translating Access SQL SELECT Title, Year, Rating, Role, Director, StageFirstName, StageLastName FROM tbl_movies INNER JOIN (tbl_actors INNER JOIN tbl_roles ON tbl_actors.ActorID = tbl_roles.ActorID) ON tbl_movies.MovieID = tbl_roles.MovieID WHERE ( ((Director)=“Allen, Woody”) AND ((StageFirstName)=“Mia”) AND ((StageLastName)=“Farrow”) );

To MySQL SELECT Title, Year, Rating, Role, Director, StageFirstName, StageLastName FROM tbl_movies, tbl_actors, tbl_roles WHERE tbl_actors.ActorID=tbl_roles.ActorID AND tbl_movies.MovieID=tbl_roles.MovieID AND Director=“Allen, Woody” AND StageFirstName=“Mia” AND StageLastName=“Farrow”

Translating INNER JOINs Access SQL SELECT … FROM tbl_movies INNER JOIN (tbl_actors INNER JOIN tbl_roles ON tbl_actors.ActorID = tbl_roles.ActorID) ON tbl_movies.MovieID = tbl_roles.MovieID WHERE … MySQL SELECT … FROM tbl_movies, tbl_actors, tbl_roles WHERE tbl_actors.ActorID = tbl_roles.ActorID AND tbl_movies.MovieID = tbl_roles.MovieID AND …

Dynamic Web Page Example We want to construct a dynamic web page that will list the actors and roles in a movie specified by the user To begin, construct a query in Access that finds the actors appearing in Gosford Park Test the query in Access Copy the SQL for query into PHP script Translate for MySQL

Using Form Parameters in SQL statement in PHP To include the PHP parameter Title in the SQL statement use curly braces Using the text {$Title}in your SQL statement will substitute the value of title Leave the double quotes around the parameter

Making the All-Purpose Form Make an HTML form which prompts for a movie’s title Use the revised PHP script as the action for the form The parameter name must match the input name of the movie title. Test with the movie Tootsie

Intro to UBT Project Work alone or in pairs There are a list of suggested topics on today’s classwork page E-mail cse103@cse.msu.edu with your first four choices We will randomly assign topics to groups or individuals next day

Server-side databases It has to have a pre-defined structure so that all people who want to construct forms know how data are stored in the database. However, different people can construct different forms provided that they use the structure of the database. A wide variety of users, many of whom know nothing about constructing forms, can query the database. Eg. IMdb.

Student Records Database Design What entities do we need to include What are the attributes for each entity? What relationships do we need? Once the design is finished, it will be frozen. No further changes will be accepted.