Advanced Web Programming Practice Exam II

Size: px
Start display at page:

Download "Advanced Web Programming Practice Exam II"

Transcription

1 Advanced Web Programming Practice Exam II Name: 12 December 2017 This is a closed book exam. You may use one sheet of notes (8.5X11in, front only) but cannot use any other references or electronic device. You will receive partial credit for everything that you do, so do as much of every problem as you can. 1. Add bodies to the two javascript functions in the html file on the following page that do the following:. a. When the button in the form is clicked it calls the function searchauthor(). This function must use AJAX to call a PHP script (in the same directory as the html file) that expects to receive an author name and category and will return an array of results. b. Use JSON to receive the array. Each element of the results array will be a string of the format Author;Title. c. The function searchbook() must call the function AddStuff(theArray) when it receives the results array. This function must add a new row to the bottom of the table for every entry in the array. This row must have the Title in the first <td> and the Author in the second <td>. d. You may not use jquery. Make your changes on the code given on the next two pages. Adv Web Exam 2 1

2 <!DOCTYPE html> <html> <body> <h1>the XMLHttpRequest Object</h1> <form id="myform"> Select a Category:<br> <input type="radio" name="genre" value="scifi" checked>sci Fi<br> <input type="radio" name="genre" value="myst">mystery<br> <input type="radio" name="genre" value="hist">historical Fiction<br> <input type="radio" name="genre" value="nonf">non-fiction<br> <br> Author Name:<input type="text" name="authorname"> <button type="button" onclick="searchauthor()">search</button> </form> <Table id="rslt"> <tr> <td><b>title</b></td> <td><b>author</b></td> </tr> </table> <script> function addstuff(thebooks){ var newrow = null; var newtd1 = null; var newtd2 = null; var element = null; var results = [ ]; element = document.getelementbyid("booktable"); results = ""; for (var i = 0; i < thebooks.length; i++){ results = thebooks[i].split(";"); newrow = document.createelement("tr"); newtd1 = document.createelement("td"); newtd2 = document.createelement("td"); newtd1.innerhtml = "<b>" + results[0] + "</b>"; newtd2.innerhtml = "<b>" + results[1] + "</b>"; newrow.appendchild(newtd1); newrow.appendchild(newtd2); element.appendchild(newrow); function searchauthor() { Adv Web Exam 2 2

3 var cat = document.forms["myform"]["category"].value; var theauthor = document.forms["myform"]["author"].value; var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readystate == 4 && this.status == 200) { alert("response text is " + this.responsetext); var thebooks = []; // Assume that a book title cannot have an ampersand in it var thebooks = JSON.parse(this.responseText); addstuff(thebooks); ; //alert("func has value " + func); xmlhttp.open("get", "library.php?type=2&cat=" + cat + "&author=" + theauthor, true); xmlhttp.send(); </script> </body> </html> Adv Web Exam 2 3

4 2. Write a PHP script that is called from the html page in the previous question and finds all the books that the author wrote in a given category that are stored in a database: a. The PHP script will receive a category and a author name: i. The first variable name is author ii. The second variable name is cat b. The script will connect to a database using the following information (the database is on the same server as the PHP script): i. User name: CS205 ii. Password: Ithaca iii. Database: BOOKS c. The database contains one table named thebooks which has the following fields (or columns): i. BookID (the primary key; it is auto-incremented and is a number) ii. Title (a varchar with up to 255 characters) iii. Author (a varchar with up to 255 characters) iv. Category (a varchar with up to 255 characters) d. Your script must connect to the database, run a query to obtain the books written by the given author, and return an array that contains elements that are strings in the form Author;Title. e. Note that the array returned by the query will not be in the correct format. f. You must use JSON to encode the array. g. Do not return any HTML or anything other than the array. Adv Web Exam 2 4

5 <?php Use this page for problem 2 $author = $_REQUEST["author"]; $cat = $_REQUEST["cat"]; $servername = "localhost"; $username = "cs205"; $password = "ithaca"; $DBname = "Books"; // Create connection $conn = new mysqli($servername, $username, $password, $DBname); // Check connection if ($conn->connect_error) { die("connection failed: ". $conn->connect_error); //echo "<h1>db results:</h1></p>"; $sql = "SELECT Author, Title FROM thebooks WHERE Author='".$author."' AND cat='".$cat"';"; $result = $conn->query($sql); $toreturn = array(); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { array_push($toreturn,$row["author"]. ";". $row["title"]. "<br>\n"; else { $toreturn[0] = "NotFound; NotFound"; echo json_encode($toreturn); $conn->close();?> Adv Web Exam 2 5

6 3. Consider database Ithaca with the five tables given below. mysql> SELECT * FROM student; firstname lastname GPA phone major dorm creditstaken studentid George Smith CS Pepsi Sally Jones CS Coke Fred Kelly CIS Dew Ashley Nevins CIS Pepper Mike Melville CIS Orange Coleen Richford CS Pepper Samantha Foley CS Pepper Cynthia James CIS Coke Sam Smalley CIS Orange rows in set (0.00 sec) mysql> SELECT * FROM instructors; firstname lastname office phone dept instructorid John Barr Williams 401A CS barr@ithaca Ali Erkan Williams 401B CS erkan@ithaca Toby Dragon Williams 401D CS tdragon@ithaca Sharon Stansfield Williams 301D CS stansfield@itha Paul Dickson Williams 301C CS pdickson@ithaca Nathan Prestopnik Williams CS nprestop@ithaca rows in set (0.00 sec) mysql> SELECT * FROM courses; courseid description instructorid days time room COMP 171 CS I MWF 9:00am Williams 303 COMP 205 Adv Web MWF 10:00am Williams 309 COMP 190 MatLAB M 4:00pm Williams 303 COMP 375 DB MWF 2:00pm Williams 303 COMP 315 Graphics MWF 11:00am Williams 309 COMP 370 AI MWF 10:00am Williams 303 COMP 210 Org TR 10:00am Williams 309 COMP 122 Legos TR 11:00am Williams 309 COMP 110 Intro T 2:30pm Williams 319 COMP 207 Game Dev MWF 4:00pm Williams 303 COMP 310 Op Sys MWF 8:00am Williams 309 COMP 123 Legos II R 2:30pm Williams rows in set (0.00 sec) mysql> SELECT * FROM student2course; studentid courseid COMP COMP COMP COMP COMP 171 Adv Web Exam 2 6

7 COMP COMP COMP COMP COMP COMP COMP COMP COMP COMP COMP COMP COMP COMP COMP COMP COMP COMP COMP COMP COMP COMP COMP COMP COMP COMP rows in set (0.00 sec) Adv Web Exam 2 7

8 a. Write an SQL query on the Ithaca database that finds the courseid of all courses taken by Cynthia that meet on MWF. Will this query return any courses? If so, list them. mysql> SELECT courses.courseid -> FROM ((students INNER JOIN student2course ON students.studentname= Cynthia AND students.studentid = student2course.studentid) -> INNER JOIN courses ON student2course.courseid = courses.courseid AND courses.days= MWF ); Returns: Comp 205 Comp 207 Comp 310 b. Write an SQL query on the Ithaca database that finds the address of all instructors that teach at 10:00am or at 2:30pm and lists them in descending order. Will this query return any addresses? If so, list them. mysql> SELECT instructors. -> FROM ((instructors INNER JOIN courses ON instructors.instructorid=courses.instructorid AND (courses.time= 10:00am OR courses.time= 2:30pm ) ORDER BY DESC; c. Note: you will not see a query this difficult on the exam. But do note the wild card character: % matches 0 or more characters of any type. Write an SQL query on the Ithaca database that finds the last name of all instructors who teach a course taken by a student whose last name begins with an N. The instructor names should be listed in ascending order. You must explicitly require the order to be ascending in the query. mysql> SELECT instructors.lastname -> FROM ((instructors INNER JOIN courses ON instructors.instructorid=courses.instructorid ) -> INNER JOIN -> (FROM students INNER JOIN student2course ON students.studentname=n% AND students.studentid = student2course.studentid) -> ON courses.courseid=student2course.courseid ORDER BY ASC; Adv Web Exam 2 8

Networks and Web for Health Informatics (HINF 6220) Tutorial 13 : PHP 29 Oct 2015

Networks and Web for Health Informatics (HINF 6220) Tutorial 13 : PHP 29 Oct 2015 Networks and Web for Health Informatics (HINF 6220) Tutorial 13 : PHP 29 Oct 2015 PHP Arrays o Arrays are single variables that store multiple values at the same time! o Consider having a list of values

More information

Greetings West Ada Comp Sci TAC & Friends,

Greetings West Ada Comp Sci TAC & Friends, Greetings West Ada Comp Sci TAC & Friends, Thank you for taking time from your busy schedules to attend our Technical Advisors Meeting (TAC) last Wed: Two teachers, five industry reps. Your inputs directly

More information

Database Connectivity using PHP Some Points to Remember:

Database Connectivity using PHP Some Points to Remember: Database Connectivity using PHP Some Points to Remember: 1. PHP has a boolean datatype which can have 2 values: true or false. However, in PHP, the number 0 (zero) is also considered as equivalent to False.

More information

APLIKACJE INTERNETOWE 8 PHP WYKORZYSTANIE BAZY DANYCH MYSQL

APLIKACJE INTERNETOWE 8 PHP WYKORZYSTANIE BAZY DANYCH MYSQL APLIKACJE INTERNETOWE 8 PHP WYKORZYSTANIE BAZY DANYCH MYSQL PLAN PREZENTACJI Bazy danych w PHP Połączenie z bazą danych Zamknięcie połączenie Tworzenie bazy danych Tworzenie tabeli Operacje na tabelach

More information

Databases and PHP. Accessing databases from PHP

Databases and PHP. Accessing databases from PHP Databases and PHP Accessing databases from PHP PHP & Databases PHP can connect to virtuay any database There are specific functions buit-into PHP to connect with some DB There is aso generic ODBC functions

More information

AJAX. Ajax: Asynchronous JavaScript and XML *

AJAX. Ajax: Asynchronous JavaScript and XML * AJAX Ajax: Asynchronous JavaScript and XML * AJAX is a developer's dream, because you can: Read data from a web server - after the page has loaded Update a web page without reloading the page Send data

More information

Use of PHP for DB Connection. Middle and Information Tier. Middle and Information Tier

Use of PHP for DB Connection. Middle and Information Tier. Middle and Information Tier Use of PHP for DB Connection 1 2 Middle and Information Tier PHP: built in library functions for interfacing with the mysql database management system $id = mysqli_connect(string hostname, string username,

More information

COMP519: Web Programming Autumn 2015

COMP519: Web Programming Autumn 2015 COMP519: Web Programming Autumn 2015 In the next lectures you will learn What is SQL How to access mysql database How to create a basic mysql database How to use some basic queries How to use PHP and mysql

More information

PHP Development - Introduction

PHP Development - Introduction PHP Development - Introduction Php Hypertext Processor PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server PHP supports many

More information

A practical introduction to database design

A practical introduction to database design A practical introduction to database design Dr. Chris Tomlinson Bioinformatics Data Science Group, Room 126, Sir Alexander Fleming Building chris.tomlinson@imperial.ac.uk Computer Skills Classes 17/01/19

More information

Use of PHP for DB Connection. Middle and Information Tier

Use of PHP for DB Connection. Middle and Information Tier Client: UI HTML, JavaScript, CSS, XML Use of PHP for DB Connection Middle Get all books with keyword web programming PHP Format the output, i.e., data returned from the DB SQL DB Query Access/MySQL 1 2

More information

Comp 519: Web Programming Autumn 2015

Comp 519: Web Programming Autumn 2015 Comp 519: Web Programming Autumn 2015 Advanced SQL and PHP Advanced queries Querying more than one table Searching tables to find information Aliasing tables PHP functions for using query results Using

More information

Web Programming. Dr Walid M. Aly. Lecture 10 PHP. lec10. Web Programming CS433/CS614 22:32. Dr Walid M. Aly

Web Programming. Dr Walid M. Aly. Lecture 10 PHP. lec10. Web Programming CS433/CS614 22:32. Dr Walid M. Aly Web Programming Lecture 10 PHP 1 Purpose of Server-Side Scripting database access Web page can serve as front-end to a database Ømake requests from browser, Øpassed on to Web server, Øcalls a program to

More information

Chapter 10: MySQL & PHP. PHP and MySQL CIS 86 Mission College

Chapter 10: MySQL & PHP. PHP and MySQL CIS 86 Mission College Chapter 10: MySQL & PHP PHP and MySQL CIS 86 Mission College Tonight s agenda Drop the class? Login file Connecting to a MySQL database Object-oriented PHP Executing a query Fetching a result Fetching

More information

CSE 154, Autumn 2012 Final Exam, Thursday, December 13, 2012

CSE 154, Autumn 2012 Final Exam, Thursday, December 13, 2012 CSE 154, Autumn 2012 Final Exam, Thursday, December 13, 2012 Name: Quiz Section: Student ID #: TA: Rules: You have 110 minutes to complete this exam. You may receive a deduction if you keep working after

More information

MySQL. A practical introduction to database design

MySQL. A practical introduction to database design MySQL A practical introduction to database design Dr. Chris Tomlinson Bioinformatics Data Science Group, Room 126, Sir Alexander Fleming Building chris.tomlinson@imperial.ac.uk Database Classes 24/09/18

More information

What is MySQL? [Document provides the fundamental operations of PHP-MySQL connectivity]

What is MySQL? [Document provides the fundamental operations of PHP-MySQL connectivity] What is MySQL? [Document provides the fundamental operations of PHP-MySQL connectivity] MySQL is a database. A database defines a structure for storing information. In a database, there are tables. Just

More information

CS 582 Database Management Systems II

CS 582 Database Management Systems II Review of SQL Basics SQL overview Several parts Data-definition language (DDL): insert, delete, modify schemas Data-manipulation language (DML): insert, delete, modify tuples Integrity View definition

More information

6. Accelerated Development with jquery Library and AJAX Technology

6. Accelerated Development with jquery Library and AJAX Technology Web Engineering I BIT Pre-Semester Accelerated Development with jquery Library and AJAX Technology (Modal Question) Lessons for Mid-Exam 1. Web Administration skills in Analysis, Design, Develop and Deploy

More information

Lecture 5. Monday, September 15, 2014

Lecture 5. Monday, September 15, 2014 Lecture 5 Monday, September 15, 2014 The MySQL Command So far, we ve learned some parts of the MySQL command: mysql [database] [-u username] p [-- local-infile]! Now let s go further 1 mysqldump mysqldump

More information

EE221 Databases Practicals Manual

EE221 Databases Practicals Manual EE221 Databases Practicals Manual Lab 1 An Introduction to SQL Lab 2 Database Creation and Querying using SQL Assignment Data Analysis, Database Design, Implementation and Relation Normalisation School

More information

Systems Programming & Scripting

Systems Programming & Scripting Systems Programming & Scripting Lecture 19: Database Support Sys Prog & Scripting - HW Univ 1 Typical Structure of a Web Application Client Internet Web Server Application Server Database Server Third

More information

Oracle 1Z Oracle Database 11g SQL Fundamentals I. Download Full Version :

Oracle 1Z Oracle Database 11g SQL Fundamentals I. Download Full Version : Oracle 1Z1-051 Oracle Database 11g SQL Fundamentals I Download Full Version : https://killexams.com/pass4sure/exam-detail/1z1-051 QUESTION: 238 You need to perform these tasks: - Create and assign a MANAGER

More information

Review. Objec,ves. Example Students Table. Database Overview 3/8/17. PostgreSQL DB Elas,csearch. Databases

Review. Objec,ves. Example Students Table. Database Overview 3/8/17. PostgreSQL DB Elas,csearch. Databases Objec,ves PostgreSQL DB Elas,csearch Review Databases Ø What language do we use to query databases? March 8, 2017 Sprenkle - CSCI397 1 March 8, 2017 Sprenkle - CSCI397 2 Database Overview Store data in

More information

CSC 3300 Homework 3 Security & Languages

CSC 3300 Homework 3 Security & Languages CSC 3300 Homework 3 Security & Languages Description Homework 3 has two parts. Part 1 is an exercise in database security. In particular, Part 1 has practice problems in which your will add constraints

More information

Introduction to MySQL /MariaDB and SQL Basics. Read Chapter 3!

Introduction to MySQL /MariaDB and SQL Basics. Read Chapter 3! Introduction to MySQL /MariaDB and SQL Basics Read Chapter 3! http://dev.mysql.com/doc/refman/ https://mariadb.com/kb/en/the-mariadb-library/documentation/ MySQL / MariaDB 1 College Database E-R Diagram

More information

Lab 7 Introduction to MySQL

Lab 7 Introduction to MySQL Lab 7 Introduction to MySQL Objectives: During this lab session, you will - Learn how to access the MySQL Server - Get hand-on experience on data manipulation and some PHP-to-MySQL technique that is often

More information

CSCB20 Week 4. Introduction to Database and Web Application Programming. Anna Bretscher Winter 2017

CSCB20 Week 4. Introduction to Database and Web Application Programming. Anna Bretscher Winter 2017 CSCB20 Week 4 Introduction to Database and Web Application Programming Anna Bretscher Winter 2017 Last Week Intro to SQL and MySQL Mapping Relational Algebra to SQL queries Focused on queries to start

More information

Task 1: JavaScript Video Event Handlers

Task 1: JavaScript Video Event Handlers Assignment 13 (NF, minor subject) Due: not submitted to UniWorX. No due date. Only for your own preparation. Goals After doing the exercises, You should be better prepared for the exam. Task 1: JavaScript

More information

Lecture 6 - More SQL

Lecture 6 - More SQL CMSC 461, Database Management Systems Spring 2018 Lecture 6 - More SQL These slides are based on Database System Concepts book and slides, 6, and the 2009/2012 CMSC 461 slides by Dr. Kalpakis Dr. Jennifer

More information

A hypothetical M:M student schedule example

A hypothetical M:M student schedule example A hypothetical : student schedule example We are interested in creating a relationship between two tables: Student and Class Section. We want to be able to be able to have students register for different

More information

MySQL Creating a Database Lecture 3

MySQL Creating a Database Lecture 3 MySQL Creating a Database Lecture 3 Robb T Koether Hampden-Sydney College Mon, Jan 23, 2012 Robb T Koether (Hampden-Sydney College) MySQL Creating a DatabaseLecture 3 Mon, Jan 23, 2012 1 / 31 1 Multiple

More information

Introduction to relational databases and MySQL

Introduction to relational databases and MySQL Chapter 3 Introduction to relational databases and MySQL A products table Columns 2017, Mike Murach & Associates, Inc. C3, Slide 1 2017, Mike Murach & Associates, Inc. C3, Slide 4 Objectives Applied 1.

More information

Mount Saint Mary College, Newburgh, NY Internet Programming III - CIT310

Mount Saint Mary College, Newburgh, NY Internet Programming III - CIT310 Warm up mini-lab Lab 1 - Functions Type in the following function definition and calls to the function. Test it and understand it. function myprint($str= No String Supplied ) // the argument is optional

More information

30. Structured Query Language (SQL)

30. Structured Query Language (SQL) 30. Structured Query Language (SQL) Java Fall 2009 Instructor: Dr. Masoud Yaghini Outline SQL query keywords Basic SELECT Query WHERE Clause ORDER BY Clause INNER JOIN Clause INSERT Statement UPDATE Statement

More information

If you do not specify any custom parameters, we will deliver the message using the default names.

If you do not specify any custom parameters, we will deliver the message using the default names. Inbound SMS to UK landline numbers API HTTP GET/POST variables If you choose to have the messages delivered by HTTP, you may either use our standard parameters, or create a custom format for compatibility

More information

The SELECT-FROM-WHERE Structure

The SELECT-FROM-WHERE Structure SQL Queries 1 / 28 The SELECT-FROM-WHERE Structure SELECT FROM WHERE From relational algebra: SELECT corresponds to projection FROM specifies

More information

Lecture 13: MySQL and PHP. Monday, March 26, 2018

Lecture 13: MySQL and PHP. Monday, March 26, 2018 Lecture 13: MySQL and PHP Monday, March 26, 2018 MySQL The Old Way In older versions of PHP, we typically used functions that started with mysql_ that did not belong to a class For example: o o o o mysql_connect()

More information

Web Systems Nov. 2, 2017

Web Systems Nov. 2, 2017 Web Systems Nov. 2, 2017 Topics of Discussion Using MySQL as a Calculator Command Line: Create a Database, a Table, Insert Values into Table, Query Database Using PhP API to Interact with MySQL o Check_connection.php

More information

wemx WebService V1.0

wemx WebService V1.0 wemx WebService 2 wemx WebService WEMX WEBSERVICE... 1 1. WEB SERVICE INTRODUCTION... 6 1.1. SYSTEM PAGE... 6 1.2. USER PAGE... 7 1.3. WEB SERVICE API... 8 2. SYSTEM PAGE PROVIDED BY THE WEB SERVICE...

More information

Chapter 7 PHP Files & MySQL Databases

Chapter 7 PHP Files & MySQL Databases Chapter 7 PHP Files & MySQL Databases At the end of the previous chapter, a simple calendar was displayed with an appointment. This demonstrated again how forms can be used to pass data from one page to

More information

TIME SCHEDULE MODULE TOPICS PERIODS. HTML Document Object Model (DOM) and javascript Object Notation (JSON)

TIME SCHEDULE MODULE TOPICS PERIODS. HTML Document Object Model (DOM) and javascript Object Notation (JSON) COURSE TITLE : ADVANCED WEB DESIGN COURSE CODE : 5262 COURSE CATEGORY : A PERIODS/WEEK : 4 PERIODS/SEMESTER : 52 CREDITS : 4 TIME SCHEDULE MODULE TOPICS PERIODS 1 HTML Document Object Model (DOM) and javascript

More information

Oracle Exam 1z0-882 Oracle Certified Professional, MySQL 5.6 Developer Version: 7.0 [ Total Questions: 100 ]

Oracle Exam 1z0-882 Oracle Certified Professional, MySQL 5.6 Developer Version: 7.0 [ Total Questions: 100 ] s@lm@n Oracle Exam 1z0-882 Oracle Certified Professional, MySQL 5.6 Developer Version: 7.0 [ Total Questions: 100 ] Oracle 1z0-882 : Practice Test Question No : 1 Consider the statements: Mysql> drop function

More information

The SELECT-FROM-WHERE Structure

The SELECT-FROM-WHERE Structure SQL Queries 1 / 28 The SELECT-FROM-WHERE Structure SELECT FROM WHERE From relational algebra: SELECT corresponds to projection FROM specifies

More information

Problem Description Earned Max 1 HTML / CSS Tracing 20 2 CSS 20 3 PHP 20 4 JS / Ajax / JSON 20 5 SQL 20 X Extra Credit 1 TOTAL Total Points 100

Problem Description Earned Max 1 HTML / CSS Tracing 20 2 CSS 20 3 PHP 20 4 JS / Ajax / JSON 20 5 SQL 20 X Extra Credit 1 TOTAL Total Points 100 CSE 154, Autumn 2012 Final Exam, Thursday, December 13, 2012 Name: Quiz Section: Student ID #: TA: Rules: You have 110 minutes to complete this exam. You may receive a deduction if you keep working after

More information

EECS1012. Net-centric Introduction to Computing. Lecture "Putting It All Together" and a little bit of AJAX

EECS1012. Net-centric Introduction to Computing. Lecture Putting It All Together and a little bit of AJAX EECS 1012 Net-centric Introduction to Computing Lecture "Putting It All Together" and a little bit of AJAX Acknowledgements The contents of these slides may be modified and redistributed, please give appropriate

More information

AN INTRODUCTION TO WEB PROGRAMMING. Dr. Hossein Hakimzadeh Department of Computer and Information Sciences Indiana University South Bend, IN

AN INTRODUCTION TO WEB PROGRAMMING. Dr. Hossein Hakimzadeh Department of Computer and Information Sciences Indiana University South Bend, IN AN INTRODUCTION TO WEB PROGRAMMING Dr. Hossein Hakimzadeh Department of Computer and Information Sciences Indiana University South Bend, IN HISTORY Developed by Michael Widenius. Initially release in 1995.

More information

XMLHttpRequest. CS144: Web Applications

XMLHttpRequest. CS144: Web Applications XMLHttpRequest http://oak.cs.ucla.edu/cs144/examples/google-suggest.html Q: What is going on behind the scene? What events does it monitor? What does it do when

More information

PHP Querying. Lecture 21. Robb T. Koether. Hampden-Sydney College. Fri, Mar 2, 2018

PHP Querying. Lecture 21. Robb T. Koether. Hampden-Sydney College. Fri, Mar 2, 2018 PHP Querying Lecture 21 Robb T. Koether Hampden-Sydney College Fri, Mar 2, 2018 Robb T. Koether (Hampden-Sydney College) PHP Querying Fri, Mar 2, 2018 1 / 32 1 Connect to the Database 2 Querying the Database

More information

LAMP Apps. Overview. Learning Outcomes: At the completion of the lab you should be able to:

LAMP Apps. Overview. Learning Outcomes: At the completion of the lab you should be able to: LAMP Apps Overview This lab walks you through using Linux, Apache, MySQL and PHP (LAMP) to create simple, yet very powerful PHP applications connected to a MySQL database. For developers using Windows,

More information

PHP: Cookies, Sessions, Databases. CS174. Chris Pollett. Sep 24, 2008.

PHP: Cookies, Sessions, Databases. CS174. Chris Pollett. Sep 24, 2008. PHP: Cookies, Sessions, Databases. CS174. Chris Pollett. Sep 24, 2008. Outline. How cookies work. Cookies in PHP. Sessions. Databases. Cookies. Sometimes it is useful to remember a client when it comes

More information

Chapters 10 & 11 PHP AND MYSQL

Chapters 10 & 11 PHP AND MYSQL Chapters 10 & 11 PHP AND MYSQL Getting Started The database for a Web app would be created before accessing it from the web. Complete the design and create the tables independently. Use phpmyadmin, for

More information

Chapter 3. Introduction to relational databases and MySQL. 2010, Mike Murach & Associates, Inc. Murach's PHP and MySQL, C3

Chapter 3. Introduction to relational databases and MySQL. 2010, Mike Murach & Associates, Inc. Murach's PHP and MySQL, C3 1 Chapter 3 Introduction to relational databases and MySQL Slide 2 Objectives Applied 1. Use phpmyadmin to review the data and structure of the tables in a database, to import and run SQL scripts that

More information

840 Database: SQL, ADO and RDS Chapter 25. Department Salary Location

840 Database: SQL, ADO and RDS Chapter 25. Department Salary Location iw3htp_25.fm Page 840 Tuesday, May 23, 2000 6:11 AM 840 Database: SQL, ADO and RDS Chapter 25 A record Number Name 25 Database: SQL, ADO and RDS Table: Employee Department Salary Location 23603 JONES,

More information

205CDE Developing the Modern Web. Assignment 2 Server Side Scripting. Scenario D: Bookshop

205CDE Developing the Modern Web. Assignment 2 Server Side Scripting. Scenario D: Bookshop 205CDE Developing the Modern Web Assignment 2 Server Side Scripting Scenario D: Bookshop Introduction This assignment was written using PHP programming language for interactions with the website and the

More information

Problem Description Earned Max 1 CSS 2 PHP 3 PHP/JSON 4 Ajax 5 Regular Expressions 6 SQL TOTAL Total Points 100

Problem Description Earned Max 1 CSS 2 PHP 3 PHP/JSON 4 Ajax 5 Regular Expressions 6 SQL TOTAL Total Points 100 CSE 154, Autumn 2014 Final Exam, Tuesday, December 9, 2014 Name: Quiz Section: Student ID #: TA: Rules: You have 110 minutes to complete this exam. You may receive a deduction if you keep working after

More information

AJAX. Introduction. AJAX: Asynchronous JavaScript and XML

AJAX. Introduction. AJAX: Asynchronous JavaScript and XML AJAX 1 2 Introduction AJAX: Asynchronous JavaScript and XML Popular in 2005 by Google Create interactive web applications Exchange small amounts of data with the server behind the scenes No need to reload

More information

Read this before starting!

Read this before starting! Points missed: Student's Name: Total score: /50 points East Tennessee State University Department of Computer and Information Sciences CSCI 2910 (Tarnoff) Server/Client Side Programming TEST 2 for Spring

More information

AJAX. Lab. de Bases de Dados e Aplicações Web MIEIC, FEUP 2010/11. Sérgio Nunes

AJAX. Lab. de Bases de Dados e Aplicações Web MIEIC, FEUP 2010/11. Sérgio Nunes AJAX Lab. de Bases de Dados e Aplicações Web MIEIC, FEUP 2010/11 Sérgio Nunes Server calls from web pages using JavaScript call HTTP data Motivation The traditional request-response cycle in web applications

More information

Secure Web-Based Systems Fall Test 1

Secure Web-Based Systems Fall Test 1 Secure Web-Based Systems Fall 2016 CS 4339 Professor L. Longpré Name: Directions: Test 1 This test is closed book and closed notes. However, you may consult the special cheat sheet provided to you with

More information

MULTIMEDIA AND WEB TECHNOLOGY

MULTIMEDIA AND WEB TECHNOLOGY SET-4 Series GBM Code No. 89 Roll No. Candidates must write the Code on the title page of the answer-book. Please check that this question paper contains 9 printed pages. Code number given on the right

More information

Chapter 3: Introduction to SQL

Chapter 3: Introduction to SQL Chapter 3: Introduction to SQL Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 3: Introduction to SQL Overview of the SQL Query Language Data Definition Basic Query

More information

Creating an Online Catalogue Search for CD Collection with AJAX, XML, and PHP Using a Relational Database Server on WAMP/LAMP Server

Creating an Online Catalogue Search for CD Collection with AJAX, XML, and PHP Using a Relational Database Server on WAMP/LAMP Server CIS408 Project 5 SS Chung Creating an Online Catalogue Search for CD Collection with AJAX, XML, and PHP Using a Relational Database Server on WAMP/LAMP Server The catalogue of CD Collection has millions

More information

Chapter 3: Introduction to SQL. Chapter 3: Introduction to SQL

Chapter 3: Introduction to SQL. Chapter 3: Introduction to SQL Chapter 3: Introduction to SQL Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 3: Introduction to SQL Overview of The SQL Query Language Data Definition Basic Query

More information

Session 11. Ajax. Reading & Reference

Session 11. Ajax. Reading & Reference Session 11 Ajax Reference XMLHttpRequest object Reading & Reference en.wikipedia.org/wiki/xmlhttprequest Specification developer.mozilla.org/en-us/docs/web/api/xmlhttprequest JavaScript (6th Edition) by

More information

CSCB20. Introduction to Database and Web Application Programming. Anna Bretscher Winter 2017

CSCB20. Introduction to Database and Web Application Programming. Anna Bretscher Winter 2017 CSCB20 Introduction to Database and Web Application Programming Anna Bretscher Winter 2017 Welcome to CSCB20 Course Description: A practical introduction to databases and Web app development. Databases:

More information

Database Management Systems

Database Management Systems Sample Questions 1 Write SQL query to create a table for describing a book. The table should have Book Title, Author, Publisher, Year published, and ISBN fields. Your table should have a primary key. For

More information

Problem Description Earned Max 1 PHP 25 2 JavaScript/DOM 25 3 Regular Expressions 25 4 SQL 25 TOTAL Total Points 100

Problem Description Earned Max 1 PHP 25 2 JavaScript/DOM 25 3 Regular Expressions 25 4 SQL 25 TOTAL Total Points 100 CSE 190 M, Spring 2011 Final Exam, Thursday, June 9, 2011 Name: Quiz Section: Student ID #: TA: Rules: You have 110 minutes to complete this exam. You may receive a deduction if you keep working after

More information

CON2DIS 2.0. Ruo Zhang Dhamma Kimpara Anagha Indic

CON2DIS 2.0. Ruo Zhang Dhamma Kimpara Anagha Indic CON2DIS 2.0 Ruo Zhang Dhamma Kimpara Anagha Indic Spring 2016 Project Objectives Utilize CON2DIS GUI from Fall 2015 Extend a database aspect to the GUI Find the link between Javascript and PHP Create a

More information

IEMS 5722 Mobile Network Programming and Distributed Server Architecture

IEMS 5722 Mobile Network Programming and Distributed Server Architecture Department of Information Engineering, CUHK MScIE 2 nd Semester, 2016/17 IEMS 5722 Mobile Network Programming and Distributed Server Architecture Lecture 6 Databases and Caches Lecturer: Albert C. M. Au

More information

COSC344 Database Theory and Applications PHP & SQL. Lecture 14

COSC344 Database Theory and Applications PHP & SQL. Lecture 14 COSC344 Database Theory and Applications Lecture 14: PHP & SQL COSC344 Lecture 14 1 Last Lecture Java & SQL Overview This Lecture PHP & SQL Revision of the first half of the lectures Source: Lecture notes,

More information

Using PHP with MYSQL

Using PHP with MYSQL Using PHP with MYSQL PHP & MYSQL So far you've learned the theory behind relational databases and worked directly with MySQL through the mysql command-line tool. Now it's time to get your PHP scripts talking

More information

Databases/JQuery AUGUST 1, 2018

Databases/JQuery AUGUST 1, 2018 Databases/JQuery AUGUST 1, 2018 Databases What is a Database? A table Durable place for storing things Place to easily lookup and update information Databases: The M in MVC What is a Database? Your Model

More information

By the end of this section of the practical, the students should be able to:

By the end of this section of the practical, the students should be able to: By the end of this section of the practical, the students should be able to: Connecting to a MySQL database in PHP with the mysql_connect() and mysql_select_db() functions Trapping and displaying database

More information

,

, Weekdays:- 1½ hrs / 3 days Fastrack:- 1½hrs / Day [Class Room and Online] ISO 9001:2015 CERTIFIED ADMEC Multimedia Institute www.admecindia.co.in 9911782350, 9811818122 ADMEC Multimedia Institute is one

More information

tablename ORDER BY column ASC tablename ORDER BY column DESC sortingorder, } The WHERE and ORDER BY clauses can be combined in one

tablename ORDER BY column ASC tablename ORDER BY column DESC sortingorder, } The WHERE and ORDER BY clauses can be combined in one } The result of a query can be sorted in ascending or descending order using the optional ORDER BY clause. The simplest form of an ORDER BY clause is SELECT columnname1, columnname2, FROM tablename ORDER

More information

SQL stands for Structured Query Language. SQL lets you access and manipulate databases

SQL stands for Structured Query Language. SQL lets you access and manipulate databases CMPSC 117: WEB DEVELOPMENT SQL stands for Structured Query Language SQL lets you access and manipulate databases SQL is an ANSI (American National Standards Institute) standard 1 SQL can execute queries

More information

WEB TECHNOLOGY LABORATORY WITH MINI PROJECT - 15CSL77

WEB TECHNOLOGY LABORATORY WITH MINI PROJECT - 15CSL77 - WEB TECHNOLOGY LABORATORY WITH MINI PROJECT [As per Choice Based Credit System (CBCS) scheme] (Effective from the academic year 2016-2017) SEMESTER VII Subject Code: IA Marks :20 Number of Lecture Hours/Week

More information

QQ Group

QQ Group QQ Group: 617230453 1 Extended Relational-Algebra-Operations Generalized Projection Aggregate Functions Outer Join 2 Generalized Projection Extends the projection operation by allowing arithmetic functions

More information

Relational model and basic SQL

Relational model and basic SQL Relational model and basic SQL Introduction to Database Design 2011, Lecture 2 Relational model and keys Basic SQL - Creating tables - Inserting rows - Retrieving information - Joins Overview 2 Relational

More information

CS127 Homework #3. Due: October 11th, :59 P.M. Consider the following set of functional dependencies, F, for the schema R(A, B, C, D, E)

CS127 Homework #3. Due: October 11th, :59 P.M. Consider the following set of functional dependencies, F, for the schema R(A, B, C, D, E) CS127 Homework #3 Warmup #1 Consider the following set of functional dependencies, F, for the schema R(A, B, C, D, E) 1. Find the candidate keys for the schema R. AB, C, D, and EA 2. Compute the closure,

More information

CS 1520 / CoE 1520: Programming Languages for Web Applications (Spring 2013) Department of Computer Science, University of Pittsburgh

CS 1520 / CoE 1520: Programming Languages for Web Applications (Spring 2013) Department of Computer Science, University of Pittsburgh CS 1520 / CoE 1520: Programming Languages for Web Applications (Spring 2013) Department of Computer Science, University of Pittsburgh Term Project: Pittsburgh Interactive Research Accounting System (piras)

More information

Introduction to InfoSec SQLI & XSS (R10+11) Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)

Introduction to InfoSec SQLI & XSS (R10+11) Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il) Introduction to InfoSec SQLI & XSS (R10+11) Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il) Covered material Useful SQL Tools SQL Injection in a Nutshell. Mass Code

More information

CSC 405 Computer Security. Web Security

CSC 405 Computer Security. Web Security CSC 405 Computer Security Web Security Alexandros Kapravelos akaprav@ncsu.edu (Derived from slides by Giovanni Vigna and Adam Doupe) 1 The XMLHttpRequest Object Microsoft developers working on Outlook

More information

Networks and Web for Health Informatics (HINF 6220)

Networks and Web for Health Informatics (HINF 6220) Networks and Web for Health Informatics (HINF 6220) Tutorial #1 Raheleh Makki Email: niri@cs.dal.ca Tutorial Class Timings Tuesday & Thursday 4:05 5:25 PM Course Outline Database Web Programming SQL PHP

More information

Problem Description Earned Max 1 PHP 25 2 JavaScript / DOM 25 3 Regular Expressions 25 TOTAL Total Points 100. Good luck! You can do it!

Problem Description Earned Max 1 PHP 25 2 JavaScript / DOM 25 3 Regular Expressions 25 TOTAL Total Points 100. Good luck! You can do it! CSE 190 M, Spring 2012 Final Exam, Thursday, June 7, 2012 Name: Quiz Section: Student ID #: TA: Rules: You have 110 minutes to complete this exam. You may receive a deduction if you keep working after

More information

What is SQL? Toolkit for this guide. Learning SQL Using phpmyadmin

What is SQL? Toolkit for this guide. Learning SQL Using phpmyadmin http://www.php-editors.com/articles/sql_phpmyadmin.php 1 of 8 Members Login User Name: Article: Learning SQL using phpmyadmin Password: Remember Me? register now! Main Menu PHP Tools PHP Help Request PHP

More information

Database Systems. phpmyadmin Tutorial

Database Systems. phpmyadmin Tutorial phpmyadmin Tutorial Please begin by logging into your Student Webspace. You will access the Student Webspace by logging into the Campus Common site. Go to the bottom of the page and click on the Go button

More information

Web Security. Attacks on Servers 11/6/2017 1

Web Security. Attacks on Servers 11/6/2017 1 Web Security Attacks on Servers 11/6/2017 1 Server side Scripting Javascript code is executed on the client side on a user s web browser Server side code is executed on the server side. The server side

More information

CGS 3066: Spring 2017 SQL Reference

CGS 3066: Spring 2017 SQL Reference CGS 3066: Spring 2017 SQL Reference Can also be used as a study guide. Only covers topics discussed in class. This is by no means a complete guide to SQL. Database accounts are being set up for all students

More information

Development Technologies. Agenda: phpmyadmin 2/20/2016. phpmyadmin MySQLi. Before you can put your data into a table, that table should exist.

Development Technologies. Agenda: phpmyadmin 2/20/2016. phpmyadmin MySQLi. Before you can put your data into a table, that table should exist. CIT 736: Internet and Web Development Technologies Lecture 10 Dr. Lupiana, DM FCIM, Institute of Finance Management Semester 1, 2016 Agenda: phpmyadmin MySQLi phpmyadmin Before you can put your data into

More information

MULTIMEDIA AND WEB TECHNOLOGY

MULTIMEDIA AND WEB TECHNOLOGY SET 4 Series : GBM/1 Code No. 89/1 Roll No. Candidates must write the Code on the title page of the answer-book. Please check that this question paper contains 08 printed pages. Code number given on the

More information

CMPS 401 Survey of Programming Languages

CMPS 401 Survey of Programming Languages CMPS 401 Survey of Programming Languages Programming Assignment #4 PHP Language On the Ubuntu Operating System Write a PHP program (P4.php) and create a HTML (P4.html) page under the Ubuntu operating system.

More information

CSc 337 Final Examination December 13, 2013

CSc 337 Final Examination December 13, 2013 On my left is: (NetID) MY NetID On my right is: (NetID) CSc 337 Final Examination December 13, 2013 READ THIS FIRST Read this page now but do not turn this page until you are told to do so. Go ahead and

More information

QUETZALANDIA.COM. 5. Data Manipulation Language

QUETZALANDIA.COM. 5. Data Manipulation Language 5. Data Manipulation Language 5.1 OBJECTIVES This chapter involves SQL Data Manipulation Language Commands. At the end of this chapter, students should: Be familiar with the syntax of SQL DML commands

More information

Databases (MariaDB/MySQL) CS401, Fall 2015

Databases (MariaDB/MySQL) CS401, Fall 2015 Databases (MariaDB/MySQL) CS401, Fall 2015 Database Basics Relational Database Method of structuring data as tables associated to each other by shared attributes. Tables (kind of like a Java class) have

More information

Real Web Development. yeah, for real.

Real Web Development. yeah, for real. Real Web Development yeah, for real. 1 who am i? i m still cyle i m a systems developer and architect every day i m developin i like this kind of stuff 2 real? kind of ranty, sorry web development is more

More information

Static Webpage Development

Static Webpage Development Dear Student, Based upon your enquiry we are pleased to send you the course curriculum for PHP Given below is the brief description for the course you are looking for: - Static Webpage Development Introduction

More information

PHP: Hypertext Preprocessor. A tutorial Introduction

PHP: Hypertext Preprocessor. A tutorial Introduction PHP: Hypertext Preprocessor A tutorial Introduction Introduction PHP is a server side scripting language Primarily used for generating dynamic web pages and providing rich web services PHP5 is also evolving

More information

Chapter. Accessing MySQL Databases Using PHP

Chapter. Accessing MySQL Databases Using PHP Chapter 12 Accessing MySQL Databases Using PHP 150 Essential PHP fast Introduction In the previous chapter we considered how to create databases using MySQL. While this is useful, it does not enable us

More information